WinTreeNavigationTest.xaml.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 
  2. ///////////////////////////////////////////////////////////////////////////////
  3. //文件名称: WinTreeNavigationTest.xaml
  4. //文件描述: WinTreeNavigationTest.xaml
  5. //创 建 者: xls
  6. //创建日期: 2018/9/20 14:57:55
  7. //版 本 号:1.0.0.0
  8. ////////////////////////////////////////////////////////////////////////////////
  9. using System;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using FWindSoft.Data;
  13. using FWindSoft.Wpf;
  14. namespace Test.TreeNavigation
  15. {
  16. /// <summary>
  17. /// WinTreeNavigationTest.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class WinTreeNavigationTest : BaseWindow
  20. {
  21. private VmTreeNavigationTest m_Vm;
  22. public WinTreeNavigationTest() : this(new VmTreeNavigationTest())
  23. {
  24. }
  25. public WinTreeNavigationTest(VmTreeNavigationTest vm)
  26. {
  27. InitializeComponent();
  28. this.m_Vm = vm;
  29. this.m_Vm.SetRefView(this);
  30. this.DataContext = this.m_Vm;
  31. }
  32. protected override void LoadData(LoadParameter parameter)
  33. {
  34. //初始化数据
  35. this.m_Vm.Init(parameter);
  36. }
  37. #region 界面关联事件
  38. private void btnOK_Click(object sender, RoutedEventArgs e)
  39. {
  40. try
  41. {
  42. if (this.HasError())
  43. {
  44. //MessageShow.Infomation("请修改错误输入项");
  45. return;
  46. }
  47. }
  48. catch (Exception ex)
  49. {
  50. //MessageShow.Show(ex);
  51. }
  52. }
  53. private void btnCancel_Click(object sender, RoutedEventArgs e)
  54. {
  55. Close();
  56. }
  57. #endregion
  58. private void DataGridRow_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
  59. {
  60. DataGridRow row = sender as DataGridRow;
  61. if (row == null)
  62. return;
  63. this.m_Vm.Root.SetSelectedItem(row.Item as TreeNavigationItem<ShowItem>);
  64. }
  65. }
  66. }