Silverlight ItemsControl - change ItemTemplate
I have an ItemsControl with a list of radio buttons - in this case the ItemTemplate will contain a binded radio button. The problem is that i开发者_如何学JAVAn some cases I need to replace the radio button with a check box without using any C# code. Is this possible? I thought at using a ValueConverter (C# code) but I don't know for sure if will work.
You could put both a radio button and a checkbox in the template, then use a binding expression in the "Visible" property that ensures only one of them is visible based on the source object being bound. If your logic to decide visibility is more complex than just a boolean on the source object, use a valueconverter in the binding expression.
精彩评论