コード例 #1
0
        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)));
        }
コード例 #2
0
        /// <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"));
            }
        }
コード例 #3
0
ファイル: Grid.cs プロジェクト: KvanTTT/Perspex
 /// <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);
 }
コード例 #4
0
 public static int GetRow(PerspexObject element)
 {
     return(element.GetValue(RowProperty));
 }
コード例 #5
0
 public static int GetColumnSpan(PerspexObject element)
 {
     return(element.GetValue(ColumnSpanProperty));
 }
コード例 #6
0
ファイル: TextBox.cs プロジェクト: strogo/Perspex
 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));
 }
コード例 #7
0
 /// <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));
 }
コード例 #8
0
 public static KeyGesture GetHotKey(PerspexObject target) => target.GetValue(HotKeyProperty);
コード例 #9
0
 /// <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));
 }
コード例 #10
0
 // ReSharper disable once UnusedMember.Global
 public static Dock GetDock(PerspexObject perspexObject)
 {
     return(perspexObject.GetValue(DockProperty));
 }
コード例 #11
0
ファイル: HotkeyManager.cs プロジェクト: rdterner/Perspex
 public static KeyGesture GetHotKey(PerspexObject target) => target.GetValue(HotKeyProperty);
コード例 #12
0
ファイル: Canvas.cs プロジェクト: shahid-pk/Perspex
 /// <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);
 }
コード例 #13
0
ファイル: Canvas.cs プロジェクト: shahid-pk/Perspex
 /// <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);
 }
コード例 #14
0
ファイル: Canvas.cs プロジェクト: shahid-pk/Perspex
 /// <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);
 }
コード例 #15
0
ファイル: Canvas.cs プロジェクト: shahid-pk/Perspex
 /// <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);
 }
コード例 #16
0
ファイル: Grid.cs プロジェクト: KvanTTT/Perspex
 /// <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);
 }
コード例 #17
0
 /// <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));
 }
コード例 #18
0
ファイル: DockPanel.cs プロジェクト: shahid-pk/Perspex
 public static Dock GetDock(PerspexObject element)
 {
     return element.GetValue(DockProperty);
 }