Using above code you will get Visibility to Collapsed. You can use mulitple functionality by passing converterparameter to converter. Sign in Email. Forgot your password? Search within: Articles Quick Answers Messages. Tagged as Silverlight. Stats Hiren Khirsaria Rate me:. Please Sign up or sign in to vote. Can you show the code and data of " Countries "? Anyway , I think , in your case " Countries " should have only string "Use "," Germany " , "Japan " and nothing else.
I had done the following as per the advise in this forum regarding binding to enums. I've debugged the strings getting returned and have not spotted any problems. GetFields BindingFlags. Static BindingFlags.
Public ;. Add attributes[0]. Hi, But how you filled the ComboBox? Your code have :. I think , this is a problem. If I do that, I'll have to update loads of xml every time I add a new enum, which is undesirable. However, I did try it for fun and it added new problems. The combobox will not select the appropriate field when a new vehicle is created. After I delete a vehicle and create a new one, the combo box for the new vehicle displays the value of the old, even though the instance of the vehicle itself in the debugger has a different country when created.
It is filled using the method "public static string[] Countries", which is part of the vehicle class. The implementation is in a response above. Can not be used as ItemsSource. I really don't think it has anything to do with the items source, since the combobox populates properly, but I am a newbie still. In this article I'll show a relatively simple and straightforward technique to achieve just that.
The XAML part that will implement the bound ConverterParameter will look as close as possible to the Error producing line of code above, with the exception that it will work This is my Third attempt in achieving a robust, simple solution for this all to well known handicap. This is my second attempt in achieving a robust, simple solution for this all to well known handicap.
The interface has two virtual methods that you should implement: Convert and ConvertBack. Here is a simple implementation of a converter that formats the Price property of the data source class to its currency representation. The Convert method is the place to introduce you custom logic. The ConvertBack method should do the inverse of what Convert does, but Silverlight isn't making use of it, so you can leave it not implemented.
In order to anticipate any problems with the conversion process of your data type, you should return DependencyProperty. Now you can declare the value converter in the resources tag of your control like this:. Now if you run the application your RadComboBox should look similar to this:. Value converters are also very useful when dealing with DateTime types. Subscribe to be the first to get our expert-written articles and tutorials for developers! Progress collects the Personal Information set out in our Privacy Policy and Privacy Policy for California Residents and uses it for the purposes stated in that policy.
0コメント