How to set default datatype
I have an ItemsControl in which all the items except the type AType
should have the same view. How could I do that?
I've tried object
as DataType
but it is forbidden (there is simplified example below):
<ItemsControl> <ItemsControl.Resources> <DataTemplate DataType="AType"> <TextBox /> </DataTemplate> <DataTemplate DataType="System:Object"> <Border> <TextBlock Text="{Binding}" /> </Border> </DataTemplate> </ItemsControl.Resources> </ItemsControl>
Answers & Comments...
Answer: 1
Answer: 1
The best bet is to use a Template Selector, like this one
That way you can easily specify the template based on whatever condition you like.
by : TriggerPinhttp://stackoverflow.com/users/1549726
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog