How in WPF C# code-behined file to assign a property from predefined set of values? -


Text after "div class =" itemprop = "text">

There is a custom control with some properties I assigned to my WPF project, they were of "string" and "bool" type Are there. Something like:

  Public class CustControl: control {static CustControl () {DefaultStyleKeyProperty.OverrideMetadata (Typeof (CustControl), New FrameworkPropertyMetadata (typeof (CustControl)); } Public Read-Only DependencyProperty CustNoProperty = DependencyProperty.Register ("CustNo", typeof (string), typeof (CustControl), New PropertyMetadata ("")); Public string CustNo {get {return (string) GetValue (CustNoProperty); } Set {Set Value (Cast Noproperty, Value); }} Public read-only stable DependencyProperty IsSelectedProperty = DependencyProperty.Register ("IsSelected", typeof (bool), typeof (CustControl), New PropertyMetadata (wrong)); Public Bull ISECited {Return (G) Gateville (ISAlited Property); } Set {Set Value (Isacled Property, Value); }} ....}  

Now to add an asset here to choose a string value from a pre-defined group of values, say, "red", "Green" is, "Yellow", "Black".

What is the right way to do this?

After the text "itemprop =" text ">

If your predefined string examples are as simple, then how to form a property type About using enum? String values ​​can be easily obtained by calling ToString () on the value value.


Comments