WPF Dependency Property (uint) eine "enum" binden
-
Hallo Leute,
ich hab ein Control mit folgenden DependencyProeprty:
public uint State { get { return (uint)GetValue(StateProperty); } set { SetValue(StateProperty, value); } } // Using a DependencyProperty as the backing store for IsActive. This enables animation, styling, binding, etc... public static readonly DependencyProperty StateProperty = DependencyProperty.Register( "State", typeof(uint), typeof(ModuleStatusControl), new UIPropertyMetadata((uint)0, new PropertyChangedCallback((s, e) => { var me = (ModuleStatusControl)s; me.OnPropertyChanged("StatusBackColor"); me.OnPropertyChanged("StatusForeColor"); me.OnPropertyChanged("StatusText"); })), new ValidateValueCallback((ot) => { return ot.GetType().IsEnum || ot.GetType().IsValueType; }));
wenn ich nun dem Property "State" in WPF ein element von Typ:
enum MyEnum: uint {...};
binden will, geht das nich!
Kann das WPF nich casten? Grüße
-
Dumme Frage: Wieso machst du das
DependencyProperty
nicht vom TypMyEnum
?Grüssli