| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using Muchinfo.MTPClient.Data.Model.Delivery;
- using Muchinfo.MTPClient.Delivery.ViewModels;
- using Muchinfo.WPF.Controls.DataGrid;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace Muchinfo.MTPClient.Delivery.Views
- {
- /// <summary>
- /// NDeliveryEntructOrderView.xaml 的交互逻辑
- /// </summary>
- public partial class NDeliveryEntructOrderView : UserControl
- {
- public NDeliveryEntructOrderView()
- {
- InitializeComponent();
- }
- private void MuchinfoDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- DataGridRow row = (DataGridRow)this.DeliveryDataGrid.ItemContainerGenerator.ContainerFromIndex(this.DeliveryDataGrid.SelectedIndex);
- CheckBox rowCheck = GetChildObject<CheckBox>(row, "DetailCheckBox");
- if (rowCheck != null)
- {
- if (rowCheck.IsChecked == true)
- {
- rowCheck.IsChecked = false;
- }
- else
- {
- rowCheck.IsChecked = true;
- }
- }
- }
- public T GetChildObject<T>(DependencyObject obj, string name) where T : FrameworkElement
- {
- DependencyObject child = null;
- T grandChild = null;
- for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
- {
- child = VisualTreeHelper.GetChild(obj, i);
- if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
- {
- return (T)child;
- }
- else
- {
- grandChild = GetChildObject<T>(child, name);
- if (grandChild != null)
- return grandChild;
- }
- }
- return null;
- }
- }
- }
|