It’s pretty easy to inherit from an existing control in WPF.
For instance, this great programmer I know has written an extended combobox. It has extra functionality, like:
* Automatically select the value if only one item is available in the items source;
* Disable the control when no items are in the items source;
So, there’s logic in the inherited class that manages the IsEnabled property.
Flexibility must remain, so consumers of this control should still be able to set the IsEnabled property, and overrule the default logic.
Here’s a way to programmatically check if the property has been set:
if (DependencyPropertyHelper.GetValueSource(this, ComboBox.IsEnabledProperty).BaseValueSource == BaseValueSource.Default)
{
IsEnabled = !(IsDisabledWhenItemsSourceIsEmpty && (_customItemsSource.Count == 0));
}
by Nestor Brathwaite
03 Apr 2010 at 03:15
Did you create your own blog or did a program do it? Could you please respond? 97
by megamoo
16 Apr 2010 at 18:07
I am not going to be original this time, so all I am going to say that your blog rocks, sad that I don’t have such a writing skills