static TextEditor()
{
FocusableProperty.OverrideDefaultValue(typeof(TextEditor), true);
CaretIndexProperty.Changed.AddClassHandler<TextEditor>((s, v) =>
{
if (s.TextDocument != null && s.CaretIndex != -1 && s.TextView != null)
{
s.InvalidateCaretPosition();
s.InvalidateSelectedWord();
}
});
HeaderProperty.Changed.AddClassHandler<TextEditor>((s, v) =>
{
if (v.OldValue as ILogical != null)
{
s.LogicalChildren.Remove(v.OldValue as ILogical);
}
if (v.NewValue as ILogical != null)
{
s.LogicalChildren.Add(v.NewValue as ILogical);
}
});
ContentProperty.Changed.AddClassHandler<TextEditor>((s, v) =>
{
if (v.OldValue as ILogical != null)
{
s.LogicalChildren.Remove(v.OldValue as ILogical);
}
if (v.NewValue as ILogical != null)
{
s.LogicalChildren.Add(v.NewValue as ILogical);
}
});
Dispatcher.UIThread.InvokeAsync(() =>
{
Application.Current.Styles.Add(new TextEditorTheme());
});
}