public TreeViewDropAdorner (ExTreeViewItem item, RowDropPosition position) : base (item) { IsHitTestVisible = false; double indent = ((item.Level + 1) * LevelToIndentConverter.IndentSize) + 5; this.shape = new System.Windows.Shapes.Rectangle(); this.shape.Stroke = Brushes.DimGray; this.shape.Width = item.ActualWidth - indent; switch (position) { case RowDropPosition.Into: this.shape.Height = item.ActualHeight; this.shape.Margin = new Thickness (indent, 0, 0, 0); this.shape.StrokeDashArray = new DoubleCollection { 1, 0, 1 }; break; case RowDropPosition.Before: this.shape.Height = 1; this.shape.Margin = new Thickness (indent, 0, 0, 0); break; case RowDropPosition.After: this.shape.Height = 1; this.shape.Margin = new Thickness (indent, item.ActualHeight, 0, 0); break; } }
public TreeViewDropAdorner(ExTreeViewItem item, RowDropPosition position) : base(item) { IsHitTestVisible = false; double indent = ((item.Level + 1) * LevelToIndentConverter.IndentSize) + 5; this.shape = new System.Windows.Shapes.Rectangle(); this.shape.Stroke = Brushes.DimGray; this.shape.Width = item.ActualWidth - indent; switch (position) { case RowDropPosition.Into: this.shape.Height = item.ActualHeight; this.shape.Margin = new Thickness(indent, 0, 0, 0); this.shape.StrokeDashArray = new DoubleCollection { 1, 0, 1 }; break; case RowDropPosition.Before: this.shape.Height = 1; this.shape.Margin = new Thickness(indent, 0, 0, 0); break; case RowDropPosition.After: this.shape.Height = 1; this.shape.Margin = new Thickness(indent, item.ActualHeight, 0, 0); break; } }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { // Get row nint row = Tree.GetRow(new CGPoint((nfloat)x, (nfloat)y)); pos = RowDropPosition.Into; nodePosition = null; if (row >= 0) { nodePosition = ((TreeItem)Tree.ItemAtRow(row)).Position; } return(nodePosition != null); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { nodePosition = null; this.dropPosition = pos = RowDropPosition.Into; x *= WidthPixelRatio; y *= HeightPixelRatio; var result = VisualTreeHelper.HitTest(Tree, new System.Windows.Point(x, y)) as PointHitTestResult; var element = (result != null) ? result.VisualHit as FrameworkElement : null; while (element != null) { if (element is ExTreeViewItem) { break; } if (element is ExTreeView) // We can't succeed past this point { return(false); } element = VisualTreeHelper.GetParent(element) as FrameworkElement; } this.dropTarget = (ExTreeViewItem)element; if (element == null) { return(false); } var point = ((UIElement)result.VisualHit).TranslatePoint(result.PointHit, element); double edge = element.ActualHeight * 0.15; if (point.Y <= edge) { this.dropPosition = pos = RowDropPosition.Before; } else if (point.Y >= element.ActualHeight - edge) { this.dropPosition = pos = RowDropPosition.After; } nodePosition = element.DataContext as TreeStoreNode; return(true); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { Gtk.TreeViewDropPosition tpos; Gtk.TreePath path; if (!Widget.GetDestRowAtPos((int)x, (int)y, out path, out tpos)) { pos = RowDropPosition.Into; nodePosition = null; return(false); } Gtk.TreeIter it; Widget.Model.GetIter(out it, path); nodePosition = new IterPos(-1, it); switch (tpos) { case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break; case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break; default: pos = RowDropPosition.Into; break; } return(true); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { Gtk.TreeViewDropPosition tpos; Gtk.TreePath path; if (!Widget.GetDestRowAtPos ((int)x, (int)y, out path, out tpos)) { pos = RowDropPosition.Into; nodePosition = null; return false; } Gtk.TreeIter it; Widget.Model.GetIter (out it, path); nodePosition = new IterPos (-1, it); switch (tpos) { case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break; case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break; default: pos = RowDropPosition.Into; break; } return true; }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { return(Backend.GetDropTargetRow(x, y, out pos, out nodePosition)); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { return Backend.GetDropTargetRow (x, y, out pos, out nodePosition); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { nodePosition = null; this.dropPosition = pos = RowDropPosition.Into; var result = VisualTreeHelper.HitTest (Tree, new System.Windows.Point (x, y)) as PointHitTestResult; var element = (result != null) ? result.VisualHit as FrameworkElement : null; while (element != null) { if (element is ExTreeViewItem) break; if (element is ExTreeView) // We can't succeed past this point return false; element = VisualTreeHelper.GetParent (element) as FrameworkElement; } this.dropTarget = (ExTreeViewItem)element; if (element == null) return false; var point = ((UIElement)result.VisualHit).TranslatePoint (result.PointHit, element); double edge = element.ActualHeight * 0.15; if (point.Y <= edge) this.dropPosition = pos = RowDropPosition.Before; else if (point.Y >= element.ActualHeight - edge) this.dropPosition = pos = RowDropPosition.After; nodePosition = element.DataContext as TreeStoreNode; return true; }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { pos = RowDropPosition.Into; nodePosition = null; return(false); }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { pos = default(RowDropPosition); nodePosition = default(TreePosition); // TODO return false; }
public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition) { throw new NotImplementedException(); }