CustomListView.xaml.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace UICommon.Controls;
  16. /// <summary>
  17. /// Interaction logic for CustomListView.xaml
  18. /// </summary>
  19. public partial class CustomListView : UserControl
  20. {
  21. public CustomListView()
  22. {
  23. InitializeComponent();
  24. }
  25. public object Source
  26. {
  27. get { return (object)GetValue(SourceProperty); }
  28. set { SetValue(SourceProperty, value); }
  29. }
  30. // Using a DependencyProperty as the backing store for Source. This enables animation, styling, binding, etc...
  31. public static readonly DependencyProperty SourceProperty =
  32. DependencyProperty.Register(nameof(Source), typeof(object), typeof(CustomListView), new PropertyMetadata(default, PropertyChangedCallback));
  33. public IEnumerable<object> ItemSource
  34. {
  35. get { return (IEnumerable<object>)GetValue(ItemSourceProperty); }
  36. set { SetValue(ItemSourceProperty, value); }
  37. }
  38. // Using a DependencyProperty as the backing store for ItemSource. This enables animation, styling, binding, etc...
  39. public static readonly DependencyProperty ItemSourceProperty =
  40. DependencyProperty.Register(nameof(ItemSource), typeof(IEnumerable<object>), typeof(CustomListView), new PropertyMetadata(default));
  41. static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  42. {
  43. }
  44. }