예제 #1
0
        private static void DataGridCellLoaded(DataGridCell sender, RoutedEventArgs e)
        {
            DataGridCell dataGridCell = (DataGridCell)sender;

            if (DataGridCellHelper.GetDataGrid(dataGridCell) == null)
            {
                DataGridCellHelper.SetDataGrid(dataGridCell, dataGridCell.TryFindParent <DataGrid>());
            }
        }
예제 #2
0
        private static void CellPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            DataGridCell dataGridCell = dependencyObject as DataGridCell;

            if (dataGridCell != null && e.NewValue != e.OldValue && e.NewValue is bool)
            {
                dataGridCell.Loaded   -= new RoutedEventHandler(DataGridCellHelper.DataGridCellLoaded);
                dataGridCell.Unloaded -= new RoutedEventHandler(DataGridCellHelper.DataGridCellUnloaded);
                DataGrid dataGrid = null;
                if ((bool)e.NewValue)
                {
                    dataGrid               = dataGridCell.TryFindParent <DataGrid>();
                    dataGridCell.Loaded   += new RoutedEventHandler(DataGridCellHelper.DataGridCellLoaded);
                    dataGridCell.Unloaded += new RoutedEventHandler(DataGridCellHelper.DataGridCellUnloaded);
                }
                DataGridCellHelper.SetDataGrid(dataGridCell, dataGrid);
            }
        }
예제 #3
0
 private static void DataGridCellUnloaded(DataGridCell sender, RoutedEventArgs e)
 {
     DataGridCellHelper.SetDataGrid((DataGridCell)sender, null);
 }