本文整理汇总了C#中UIElement.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.GetValue方法的具体用法?C# UIElement.GetValue怎么用?C# UIElement.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HookUpEvents
private void HookUpEvents(UIElement uiElement)
{
// VisualTreeHelper.GetParent(uiElement) as UIElement;
uiElement.MouseEnter += (sender, o) => { logger.Trace("OnMouseEnter {0}", uiElement.GetValue(NameProperty)); };
uiElement.MouseLeave += (sender, o) => { logger.Trace("OnMouseLeave {0}", uiElement.GetValue(NameProperty)); };
}
示例2: StartAnimation
/// <summary>
/// Starts an animation to a particular value on the specified dependency property.
/// You can pass in an event handler to call when the animation has completed.
/// </summary>
public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
{
double fromValue = (double)animatableElement.GetValue(dependencyProperty);
DoubleAnimation animation = new DoubleAnimation();
animation.From = fromValue;
animation.To = toValue;
animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);
animation.Completed += delegate(object sender, EventArgs e)
{
//
// When the animation has completed bake final value of the animation
// into the property.
//
animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
CancelAnimation(animatableElement, dependencyProperty);
if (completedEvent != null)
{
completedEvent(sender, e);
}
};
//TODO// animation.Freeze();
//TODO// animatableElement.BeginAnimation(dependencyProperty, animation);
}
示例3: CellRange
/// <summary>
/// Initializes a new instance of a <see cref="T:C1.WPF.FlexGrid.CellRange" /> based on a
/// <see cref="T:System.Windows.UIElement" /> that represents a cell.
/// </summary>
/// <param name="e">
/// <see cref="T:System.Windows.UIElement" /> that represents a cell.
/// </param>
public CellRange(UIElement e)
{
if (e.ReadLocalValue(Grid.RowProperty) == DependencyProperty.UnsetValue)
{
_row = _col = _row2 = _col2 = -1;
return;
}
_row = (int) e.GetValue(Grid.RowProperty);
_col = (int) e.GetValue(Grid.ColumnProperty);
_row2 = _row + (int) e.GetValue(Grid.RowSpanProperty) - 1;
_col2 = _col + (int) e.GetValue(Grid.ColumnSpanProperty) - 1;
}
示例4: GetDock
public static Dock GetDock(UIElement element)
{
if (element == null)
throw new ArgumentNullException("element");
return (Dock)element.GetValue(DockProperty);
}
示例5: GetCanBeDragged
public static bool GetCanBeDragged(UIElement uiElement)
{
if (uiElement == null)
return false;
return (bool)uiElement.GetValue(CanBeDraggedProperty);
}
示例6: GetRight
public static double GetRight(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (double)element.GetValue(RightProperty);
}
示例7: GetIsMemoryEfficient
/// <summary>
/// Gets the value of the IsMemoryEfficient attached property for a specified UIElement.
/// </summary>
/// <param name="element">The UIElement from which the property value is read.</param>
/// <returns>The IsMemoryEfficient property value for the UIElement.</returns>
public static bool GetIsMemoryEfficient(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (bool)element.GetValue(IsMemoryEfficientProperty);
}
示例8: GetTabIndex
/// <summary>
/// Gets an integer representing the specified <see cref="UIElement"/>'s Tab index
/// </summary>
/// <param name="element">The <see cref="UIElement"/> who's Tab index is to return</param>
/// <returns>An integer</returns>
public static int GetTabIndex(UIElement element)
{
if (!element.DependencyProperties.ContainsKey(KeyboardNavigation.TabIndexProperty))
{
return -1;
}
return element.GetValue<int>(KeyboardNavigation.TabIndexProperty);
}
示例9: GetOffset
/// <summary>
/// Gets a <see cref="Media.Point"/> representing the specified <see cref="UIElement"/>'s offset
/// </summary>
/// <param name="element">The <see cref="UIElement"/> to get the offset of</param>
/// <returns>A <see cref="Media.Point"/> representing the specified <see cref="UIElement"/>'s offset</returns>
public static Media.Point GetOffset(UIElement element)
{
if (!element.DependencyProperties.ContainsKey(StackPanel.OffsetProperty))
{
throw new ArgumentException("The UIElement passed as 'element' argument is not the child of a StackPanel");
}
return element.GetValue<Media.Point>(StackPanel.OffsetProperty);
}
示例10: GetIsTabStop
/// <summary>
/// Gets a boolean indicating whether or not the specified element is a Tab stop
/// </summary>
/// <param name="element">The <see cref="UIElement"/> to check</param>
/// <returns>A boolean</returns>
public static bool GetIsTabStop(UIElement element)
{
if (!element.DependencyProperties.ContainsKey(KeyboardNavigation.IsTabStopProperty))
{
return false;
}
return element.GetValue<bool>(KeyboardNavigation.IsTabStopProperty);
}
示例11: GetTop
public static double GetTop(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (double)element.GetValue(Canvas.TopProperty);
}
示例12: GetCanvasProperty
static double GetCanvasProperty(UIElement element, DependencyProperty d)
{
double v = (double)element.GetValue(d);
if (double.IsNaN(v))
return 0;
else
return v;
}
示例13: GetRelativePosition
public static Point GetRelativePosition(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (Point)element.GetValue(RelativePositionProperty);
}
示例14: GetTop
static double GetTop(UIElement element)
{
double v = (double)element.GetValue(Canvas.TopProperty);
if (double.IsNaN(v))
return 0;
else
return v;
}
示例15: GetEdge
public static Edge GetEdge(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (Edge)element.GetValue(EdgeProperty);
}