本文整理汇总了C#中System.Windows.FrameworkElement.SetCurrentValue方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.SetCurrentValue方法的具体用法?C# FrameworkElement.SetCurrentValue怎么用?C# FrameworkElement.SetCurrentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.SetCurrentValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(FrameworkElement frameworkElement)
{
if (frameworkElement == null) throw new ArgumentNullException("frameworkElement");
frameworkElement.SetCurrentValue(FrameworkElement.WidthProperty, _width);
frameworkElement.SetCurrentValue(FrameworkElement.HeightProperty, _height);
}
示例2: UpdateObservedSizesForFrameworkElement
private static void UpdateObservedSizesForFrameworkElement(FrameworkElement frameworkElement)
{
// WPF 4.0 onwards
frameworkElement.SetCurrentValue(ObservedWidthProperty, frameworkElement.ActualWidth);
frameworkElement.SetCurrentValue(ObservedHeightProperty, frameworkElement.ActualHeight);
// WPF 3.5 and prior
////SetObservedWidth(frameworkElement, frameworkElement.ActualWidth);
////SetObservedHeight(frameworkElement, frameworkElement.ActualHeight);
}
示例3: UpdateObservedSizesForFrameworkElement
private static void UpdateObservedSizesForFrameworkElement(FrameworkElement frameworkElement)
{
frameworkElement.SetCurrentValue(ObservedWidthProperty, frameworkElement.ActualWidth);
frameworkElement.SetCurrentValue(ObservedHeightProperty, frameworkElement.ActualHeight);
}
示例4: CreateEntryAnimation
public Storyboard CreateEntryAnimation(FrameworkElement animatedObject, double xDelta, double yDelta)
{
var translateTransform = animatedObject.RenderTransform as TranslateTransform;
animatedObject.Opacity = 0.0;
animatedObject.SetCurrentValue(FrameworkElement.OpacityProperty, 0.0);
if (translateTransform == null)
{
animatedObject.RenderTransform = translateTransform = new TranslateTransform(xDelta, yDelta);
}
else
{
translateTransform.SetCurrentValue(TranslateTransform.XProperty, translateTransform.X + xDelta);
translateTransform.SetCurrentValue(TranslateTransform.YProperty, translateTransform.X + yDelta);
}
var storyboard = new Storyboard { FillBehavior = FillBehavior.Stop };
var animationOpacity = new DoubleAnimation
{
Duration = _exitDuration,
BeginTime = CalculateStagger(),
From = 0,
To = 1,
EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut }
};
Storyboard.SetTarget(animationOpacity, animatedObject);
Storyboard.SetTargetProperty(animationOpacity, new PropertyPath(UIElement.OpacityProperty));
storyboard.Children.Add(animationOpacity);
var animationX = new DoubleAnimation
{
Duration = _exitDuration,
BeginTime = CalculateStagger(),
To = 0,
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
};
Storyboard.SetTarget(animationX, animatedObject);
Storyboard.SetTargetProperty(animationX, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
storyboard.Children.Add(animationX);
var animationY = new DoubleAnimation
{
Duration = _exitDuration,
BeginTime = CalculateStagger(),
To = 0,
EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut }
};
Storyboard.SetTarget(animationY, animatedObject);
Storyboard.SetTargetProperty(animationY, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
storyboard.Children.Add(animationY);
storyboard.Completed += (s, e) =>
{
animatedObject.Opacity = 1.0;
translateTransform.X = translateTransform.X;
translateTransform.Y = translateTransform.Y;
};
return storyboard;
}