CustomViewTest.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Shapes;
  14. namespace Test
  15. {
  16. /// <summary>
  17. /// CustomViewTest.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class CustomViewTest : Window
  20. {
  21. public CustomViewTest()
  22. {
  23. InitializeComponent();
  24. InitListView();
  25. }
  26. private void InitListView()
  27. {
  28. List<DisplayItem> items = new List<DisplayItem>();
  29. for (int i = 0; i < 20; i++)
  30. {
  31. items.Add(new DisplayItem() { Display = i.ToString(), ToolTip = i.ToString(), ImagePath = @"G:\SVNCode\PtahRevitDesigner\trunk\PtahRevitDesigner\PtahAI\Resources\background.jpg" });
  32. }
  33. ListView.ItemsSource = items;
  34. }
  35. }
  36. public class DisplayItem
  37. {
  38. public string Display { get; set; }
  39. public string ToolTip { get; set; }
  40. public string ImagePath { get; set; }
  41. }
  42. }