I am trying to create a custom ItemsControl by directly inheriting from ItemsControl (WPF/Silverlight, I am using same code base for both). I have created an Item class for it by inheriting from ContentControl. I want to create IsSelected property for the Item class. I reflected the ListBoxItem class but am not very clear how IsSelected property is getting set.
Any suggestions/ pointers will be really helpful.
I am trying to create a custom ItemsControl by directly inheriting from ItemsControl (WPF/Silverlight,
Share
If you want an
ItemsControlwith noListBoxfeatures except that it internally supports the concept of selection, you can easily create a looklessListBoxthat is indistinguishable from anItemsControl. Here are the two two side by side and you can’t tell the difference. The only difference is that the left list supports selection internally.So the best advice is if you want selection, derive from
ListBoxand style away what you don’t want about it or at least derive fromSelector.