Esempio n. 1
0
            EtoBorder Create(swc.DataGridCell cell)
            {
                var control = GetControl <EtoBorder>(cell);

                if (control == null)
                {
                    control = new EtoBorder {
                        Column = this
                    };
                    control.Unloaded                     += HandleControlUnloaded;
                    control.Loaded                       += HandleControlLoaded;
                    control.DataContextChanged           += HandleControlDataContextChanged;
                    control.PreviewMouseDown             += HandlePreviewMouseDown;
                    control.IsKeyboardFocusWithinChanged += HandleIsKeyboardFocusWithinChanged;

                    if (!Equals(cell.GetValue(dpSelectedHookedUp), true))
                    {
                        cell.SetValue(dpSelectedHookedUp, true);
                        cell.Selected   += HandleCellSelectedChanged;
                        cell.Unselected += HandleCellSelectedChanged;
                    }
                    var grid = cell.GetVisualParent <swc.DataGrid>();
                    if (grid != null && !Equals(grid.GetValue(dpSelectedHookedUp), true))
                    {
                        grid.SetValue(dpSelectedHookedUp, true);
                        grid.IsKeyboardFocusWithinChanged += HandleRowFocusChanged;
                    }
                }
                return(control);
            }
Esempio n. 2
0
 internal static void CacheFlowDirection(FrameworkElement element, DataGridCell cell)
 {
     if (element != null && cell != null)
     {
         object flowDirectionObj = element.ReadLocalValue(FrameworkElement.FlowDirectionProperty);
         if (flowDirectionObj != DependencyProperty.UnsetValue)
         {
             cell.SetValue(FlowDirectionCacheProperty, flowDirectionObj);
         }
     }
 }