Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public partial class MyListBox: ListBox
  2. {
  3.  
  4. protected override System.Windows.DependencyObject GetContainerForItemOverride()
  5. {
  6. return new MyListBoxItem();
  7. }
  8.  
  9. protected override bool IsItemItsOwnContainerOverride(object item)
  10. {
  11. return item is MyListBoxItem;
  12. }
  13. }
  14.  
  15. public class MyListBoxItem : ListBoxItem
  16. {
  17.  
  18. }
  19.  
  20. <local:MyListBox ItemsSource="{Binding Items}">
  21. <local:MyListBox.ItemTemplate>
  22. <DataTemplate>
  23. <TextBlock Text="{Binding id}"/>
  24. </DataTemplate>
  25. </local:MyListBox.ItemTemplate>
  26. </local:MyListBox>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement