0
私はWPF/C#学習プロジェクトとしてテキストエディタを作ろうとしています。
私は3つのトグルボタン(下線、上書き、取り消し線)を持っています。
- これらは組み合わせて表示されますが、どのように検出できますか?マイselectionChangedのEventHandlerRichTectBox選択で複数の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を期待...
- どんなこと - 全く混乱