private static int ValidateCaretIndex(PerspexObject o, int value) { var text = o.GetValue(TextProperty); var length = (text != null) ? text.Length : 0; return(Math.Max(0, Math.Min(length, value))); }
/// <summary> /// Gets a diagnostic for a <see cref="PerspexProperty"/> on a <see cref="PerspexObject"/>. /// </summary> /// <param name="o">The object.</param> /// <param name="property">The property.</param> /// <returns> /// A <see cref="PerspexPropertyValue"/> that can be used to diagnose the state of the /// property on the object. /// </returns> public static PerspexPropertyValue GetDiagnostic(this PerspexObject o, PerspexProperty property) { var set = o.GetSetValues(); PriorityValue value; if (set.TryGetValue(property, out value)) { return(new PerspexPropertyValue( property, o.GetValue(property), (BindingPriority)value.ValuePriority, value.GetDiagnostic())); } else { return(new PerspexPropertyValue( property, o.GetValue(property), BindingPriority.Unset, "Unset")); } }
/// <summary> /// Gets the value of the Column attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's column.</returns> public static int GetColumn(PerspexObject element) { return element.GetValue(ColumnProperty); }
public static int GetRow(PerspexObject element) { return(element.GetValue(RowProperty)); }
public static int GetColumnSpan(PerspexObject element) { return(element.GetValue(ColumnSpanProperty)); }
private static int ValidateCaretIndex(PerspexObject o, int value) { var text = o.GetValue(TextProperty); var length = (text != null) ? text.Length : 0; return Math.Max(0, Math.Min(length, value)); }
/// <summary> /// Gets the value of the Right attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's right coordinate.</returns> public static double GetRight(PerspexObject element) { return(element.GetValue(RightProperty)); }
public static KeyGesture GetHotKey(PerspexObject target) => target.GetValue(HotKeyProperty);
/// <summary> /// Gets the value of the Bottom attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's bottom coordinate.</returns> public static double GetBottom(PerspexObject element) { return(element.GetValue(BottomProperty)); }
// ReSharper disable once UnusedMember.Global public static Dock GetDock(PerspexObject perspexObject) { return(perspexObject.GetValue(DockProperty)); }
/// <summary> /// Gets the value of the Right attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's right coordinate.</returns> public static double GetRight(PerspexObject element) { return element.GetValue(RightProperty); }
/// <summary> /// Gets the value of the Top attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's top coordinate.</returns> public static double GetTop(PerspexObject element) { return element.GetValue(TopProperty); }
/// <summary> /// Gets the value of the Left attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's left coordinate.</returns> public static double GetLeft(PerspexObject element) { return element.GetValue(LeftProperty); }
/// <summary> /// Gets the value of the Bottom attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's bottom coordinate.</returns> public static double GetBottom(PerspexObject element) { return element.GetValue(BottomProperty); }
/// <summary> /// Gets the value of the RowSpan attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's row span.</returns> public static int GetRowSpan(PerspexObject element) { return element.GetValue(RowSpanProperty); }
/// <summary> /// Gets the value of the Top attached property for a control. /// </summary> /// <param name="element">The control.</param> /// <returns>The control's top coordinate.</returns> public static double GetTop(PerspexObject element) { return(element.GetValue(TopProperty)); }
public static Dock GetDock(PerspexObject element) { return element.GetValue(DockProperty); }