public static void SetOrder(Layoutable layoutable, int value) { if (layoutable is null) { throw new ArgumentNullException(nameof(layoutable)); } layoutable.SetValue(OrderProperty, value); }
protected override void OnTemplateApplied(TemplateAppliedEventArgs e) { base.OnTemplateApplied(e); headerControl = e.NameScope.Find(partHeader) as Layoutable; selectedControl = e.NameScope.Find(partSelected) as Layoutable; ApplyBinding(); }
public static int GetOrder(Layoutable layoutable) { if (layoutable is null) { throw new ArgumentNullException(nameof(layoutable)); } return(layoutable.GetValue(OrderProperty)); }
public static void SetAlignSelf(Layoutable layoutable, AlignItems?value) { if (layoutable is null) { throw new ArgumentNullException(nameof(layoutable)); } layoutable.SetValue(AlignSelfProperty, value); }
public static AlignItems?GetAlignSelf(Layoutable layoutable) { if (layoutable is null) { throw new ArgumentNullException(nameof(layoutable)); } return(layoutable.GetValue(AlignSelfProperty)); }
public GraphNode AddNode(Layoutable value) { if (!_nodeDic.ContainsKey(value)) { var node = new GraphNode(value); _nodeDic.Add(value, node); return(node); } return(_nodeDic[value]); }
public GraphNode(Layoutable element) { OutgoingNodes = new HashSet <GraphNode>(); Element = element; }
/// <summary> /// Resize and resposition the SelectionRangeElement. /// </summary> private void UpdateSelectionRangeElementPositionAndSize() { Size trackSize = new Size(0d, 0d); Size thumbSize = new Size(0d, 0d); if (Track == null || DoubleUtil.LessThan(SelectionEnd, SelectionStart)) { return; } trackSize = Track.DesiredSize; //Track.RenderSize; thumbSize = (Track.Thumb != null) ? /*Track.Thumb.RenderSize*/ Track.Thumb.DesiredSize : new Size(0d, 0d); double range = Maximum - Minimum; double valueToSize; Layoutable rangeElement = this.SelectionRangeElement as Layoutable; if (rangeElement == null) { return; } if (Orientation == Orientation.Horizontal) { // Calculate part size for HorizontalSlider if (DoubleUtil.AreClose(range, 0d) || (DoubleUtil.AreClose(trackSize.Width, thumbSize.Width))) { valueToSize = 0d; } else { valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range); } rangeElement.Width = ((SelectionEnd - SelectionStart) * valueToSize); if (IsDirectionReversed) { Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize); } else { Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize); } } else { // Calculate part size for VerticalSlider if (DoubleUtil.AreClose(range, 0d) || (DoubleUtil.AreClose(trackSize.Height, thumbSize.Height))) { valueToSize = 0d; } else { valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range); } rangeElement.Height = ((SelectionEnd - SelectionStart) * valueToSize); if (IsDirectionReversed) { Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize); } else { Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize); } } }
public static Size GetMinControlSize(Layoutable control) { control.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); control.Arrange(new Rect(control.DesiredSize)); return(control.Bounds.Size); }