Hi !
I want to derive from System.Windows.Controls.TextBox and provide this functionality.
IsEnabledProperty.OverrideMetadata(typeof(MyTextBox), new FrameworkPropertyMetadata(
new PropertyChangedCallback(delegate(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
MyTextBox tb = o as MyTextBox;
if (tb != null && !tb.IsEnabled)
{
tb.SetValue(TextProperty, null);
tb.OnLostFocus(new RoutedEventArgs(LostFocusEvent, typeof(MyTextBox)));
}
}
)));
The problem is that if I write a Custom Control, nothing will be displayed when using it, but I don't want to write my custom Template. I want to use the original one.
How would you do that, please ?