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); }
public DateTimePickerHandler() { Control = new EtoBorder { Handler = this, Focusable = false }; Mode = DateTimePickerMode.Date; }
EtoBorder Create(swc.DataGridCell cell) { var control = new EtoBorder { Column = this }; control.Args = new WpfCellEventArgs(-1, null, CellStates.None); control.DataContextChanged += (sender, e) => { var ctl = sender as EtoBorder; ctl.Args.SetSelected(cell.IsSelected); ctl.Args.SetDataContext(ctl.DataContext); var id = Handler.Callback.OnGetIdentifier(Handler.Widget, ctl.Args); var child = ctl.Control; if (id != ctl.Identifier || child == null) { Stack <Control> cache; if (child != null) { // store old child into cache cache = GetCached(ctl.Identifier); cache.Push(child); } // get new from cache or create if none created yet cache = GetCached(id); if (cache.Count > 0) { child = cache.Pop(); } else { child = Handler.Callback.OnCreateCell(Handler.Widget, ctl.Args); } ctl.Control = child; var handler = child.GetWpfFrameworkElement(); if (handler != null) { handler.SetScale(true, true); } ctl.Child = child.ToNative(true); } Handler.Callback.OnConfigureCell(Handler.Widget, ctl.Args, child); Handler.FormatCell(ctl, cell, ctl.DataContext); ctl.InvalidateVisual(); }; cell.Selected += (sender, e) => { control.Args.SetSelected(cell.IsSelected); Handler.Callback.OnConfigureCell(Handler.Widget, control.Args, control.Control); }; cell.Unselected += (sender, e) => { control.Args.SetSelected(cell.IsSelected); Handler.Callback.OnConfigureCell(Handler.Widget, control.Args, control.Control); }; return(control); }
public PanelHandler() { Control = new EtoBorder { Handler = this, Focusable = false, Background = swm.Brushes.Transparent // to get mouse events }; }
public ScrollableHandler() { Control = new EtoBorder { Handler = this, SnapsToDevicePixels = true, Focusable = false, }; scroller = new EtoScrollViewer { Handler = this, VerticalScrollBarVisibility = swc.ScrollBarVisibility.Auto, HorizontalScrollBarVisibility = swc.ScrollBarVisibility.Auto, CanContentScroll = true, SnapsToDevicePixels = true, Focusable = false }; scroller.SizeChanged += HandleSizeChanged; scroller.Loaded += HandleSizeChanged; Control.Child = scroller; Control.SetEtoBorderType(BorderType.Bezel); }