本文整理汇总了C#中System.Windows.UIElement.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.GetValue方法的具体用法?C# UIElement.GetValue怎么用?C# UIElement.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.UIElement
的用法示例。
在下文中一共展示了UIElement.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
};
animation.Freeze();
animatableElement.BeginAnimation(dependencyProperty, animation);
}
示例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>
/// <param name="pAnimatableElement">The gui element to animate.</param>
/// <param name="pDependencyProperty">The dependency property to animate.</param>
/// <param name="pToValue">The final value of the dependency property.</param>
/// <param name="pAnimationDurationSeconds">The animation duration.</param>
/// <param name="pCompletedEvent">The callback executed when the animation ended.</param>
public static void StartAnimation(UIElement pAnimatableElement, DependencyProperty pDependencyProperty, double pToValue, double pAnimationDurationSeconds, EventHandler pCompletedEvent)
{
double lFromValue = (double)pAnimatableElement.GetValue(pDependencyProperty);
DoubleAnimation lAnimation = new DoubleAnimation();
lAnimation.From = lFromValue;
lAnimation.To = pToValue;
lAnimation.Duration = TimeSpan.FromSeconds(pAnimationDurationSeconds);
lAnimation.Completed += delegate(object pSender, EventArgs pEventArgs)
{
//
// When the animation has completed bake final value of the animation
// into the property.
//
pAnimatableElement.SetValue(pDependencyProperty, pAnimatableElement.GetValue(pDependencyProperty));
CancelAnimation(pAnimatableElement, pDependencyProperty);
if (pCompletedEvent != null)
{
pCompletedEvent(pSender, pEventArgs);
}
};
lAnimation.Freeze();
pAnimatableElement.BeginAnimation(pDependencyProperty, lAnimation);
}
示例3: 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 animationElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
{
if (animationElement == null)
{
throw new ArgumentNullResourceException("animationElement", Resources.General_Given_Parameter_Cannot_Be_Null);
}
var fromValue = (double)animationElement.GetValue(dependencyProperty);
var animation = new DoubleAnimation { From = fromValue, To = toValue, Duration = TimeSpan.FromSeconds(animationDurationSeconds) };
animation.Completed += (sender, e) =>
{
// When the animation has completed bake final value of the animation
// into the property.
animationElement.SetValue(dependencyProperty, animationElement.GetValue(dependencyProperty));
CancelAnimation(animationElement, dependencyProperty);
if (completedEvent != null)
{
completedEvent(sender, e);
}
};
animation.Freeze();
animationElement.BeginAnimation(dependencyProperty, animation);
}
示例4: GetGroupRecordInfo
public static GroupRecord GetGroupRecordInfo(UIElement element)
{
if (element == null)
return null;
return (GroupRecord)element.GetValue(GroupRecordInfoProperty);
}
示例5: GetCommandBindings
/// <summary>
/// Gets the command bindings.
/// </summary>
///
public static CommandBindingCollection GetCommandBindings(UIElement element)
{
if (element == null)
return null;
return (CommandBindingCollection)element.GetValue(RegisterCommandBindingsProperty);
}
示例6: GetNavigationOutTransition
/// <summary>
/// Gets the
/// <see cref="T:Microsoft.Phone.Controls.NavigationTransition"/>s
/// of
/// <see cref="M:Microsoft.Phone.Controls.TransitionService.NavigationOutTransitionProperty"/>
/// for a
/// <see cref="T:System.Windows.UIElement"/>.
/// </summary>
/// <param name="element">The <see cref="T:System.Windows.UIElement"/>.</param>
/// <returns>The </returns>
public static NavigationOutTransition GetNavigationOutTransition(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (NavigationOutTransition)element.GetValue(NavigationOutTransitionProperty);
}
示例7: GetIsEdit
public static bool GetIsEdit(UIElement uiElement)
{
if (uiElement == null)
{
throw new ArgumentNullException("uiElement");
}
return (bool)uiElement.GetValue(IsEditProperty);
}
示例8: GetSortDirection
public static ListSortDirection? GetSortDirection(UIElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return (ListSortDirection?)element.GetValue(SortDirectionProperty);
}
示例9: GetFocusedChild
public static IInputElement GetFocusedChild(UIElement element)
{
if (element == null)
throw new ArgumentNullException("element");
WeakReference r = (WeakReference)element.GetValue(FocusedChildProperty);
if (r != null)
return (IInputElement)r.Target;
else
return null;
}
示例10: GetContextMenu
/// <summary>
/// Gets the value of the Menu attached property from a given DependencyObject.
/// </summary>
/// <param name="control">The element from which to read the property value.</param>
/// <returns>The value of the Menu attached property.</returns>
public static Menu GetContextMenu(UIElement control)
{
// preconditions
Argument.IsNotNull("control", control);
// implementation
return control.GetValue(ContextMenuProperty) as Menu;
}
示例11: GetMouseScrollUp
public static ICommand GetMouseScrollUp(UIElement element)
{
return (ICommand)element.GetValue(MouseScrollUpProperty);
}
示例12: GetPreviewDropCommand
public static ICommand GetPreviewDropCommand(UIElement obj)
{
return (ICommand)obj.GetValue(PreviewDropCommandProperty);
}
示例13: GetMouseDoubleClick
public static ICommand GetMouseDoubleClick(UIElement element)
{
return (ICommand)element.GetValue(MouseDoubleClickProperty);
}
示例14: GetMouseClicktoggleBool
public static bool? GetMouseClicktoggleBool(UIElement element)
{
return (bool?)element.GetValue(MouseClicktoggleBoolProperty);
}
示例15: GetMouseActions
public static MouseActionCollection GetMouseActions(UIElement element)
{
return (MouseActionCollection)element.GetValue(MouseActionsProperty);
}