0
저는 WPF/C# 학습 프로젝트로 텍스트 편집기를 만들려고합니다.
세 개의 토글 버튼 (밑줄, 겹침 및 취소 선)이 있습니다.
- 이것들은 조합으로 나타날 수 있지만 어떻게 감지합니까? 내에서 selectionChanged 이벤트 핸들러RichTectBox 선택에서 여러 TextDecorations 감지
:
private void rt_SelectionChanged(object sender, RoutedEventArgs e)
{
bool IsTextUnderline = false;
bool IsTextStrikethrough = false;
bool IsOverline = false;
TextRange range = new TextRange(rt.Selection.Start, rt.Selection.End);
var decor = range.GetPropertyValue(Inline.TextDecorationsProperty);
if (decor != DependencyProperty.UnsetValue)
{
TextDecorationCollection coll = (TextDecorationCollection)decor;
IsTextStrikethrough = (coll.Contains(TextDecorations.Strikethrough));
그러나 .Contains()는 매개 변수로 TextDecorationCollection 기대 ...
- 무엇이든 그 - 완전히 혼란