本文整理汇总了C#中Windows.UI.Xaml.UIElement.Arrange方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.Arrange方法的具体用法?C# UIElement.Arrange怎么用?C# UIElement.Arrange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.UIElement
的用法示例。
在下文中一共展示了UIElement.Arrange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArrangeChildFluently
protected void ArrangeChildFluently(UIElement child, Point targetPosition, Size childSize, Duration duration)
{
if (_currentStoryboardDisposable == null)
throw new InvalidOperationException("You must call BeginStoryboard before arranging UI Elements fluently");
var translateTransform = child.RenderTransform as TranslateTransform;
if (translateTransform == null)
child.RenderTransform = translateTransform = new TranslateTransform();
child.Arrange(new Rect(new Point(), childSize));
_currentStoryboardDisposable.AddAnimtation(CreateDoubleAnimation(targetPosition.X,
duration,
child,
TranslateXPath));
_currentStoryboardDisposable.AddAnimtation(CreateDoubleAnimation(targetPosition.Y,
duration,
child,
TranslateYPath));
}
示例2: ArrangeCollapseElement
private void ArrangeCollapseElement(int idx, UIElement element,
double panelCenterX, double panelCenterY,
double elementCenterX, double elementCenterY,
double destX, double destY)
{
element.Arrange(new Rect(destX, destY, element.DesiredSize.Width, element.DesiredSize.Height));
var aniDuration = AnimationDuration + TimeSpan.FromSeconds(AnimationDurationStep * idx);
var storySpin = new Storyboard();
var translateXAnimation = new DoubleAnimation() { From = 0, To = panelCenterX - destX, Duration = aniDuration };
var translateYAnimation = new DoubleAnimation() { From = 0, To = panelCenterY - destY, Duration = aniDuration };
var transparentAnimation = new DoubleAnimation() { From = 1, To = 0, Duration = aniDuration };
var rotateXAnimation = new DoubleAnimation() { From = 0, To = panelCenterX - destX, Duration = aniDuration };
var rotateYAnimation = new DoubleAnimation() { From = 0, To = panelCenterY - destY, Duration = aniDuration };
var rotateAngleAnimation = new DoubleAnimation() { From = 0, To = -720, Duration = aniDuration };
storySpin.Children.Add(translateXAnimation);
storySpin.Children.Add(translateYAnimation);
storySpin.Children.Add(transparentAnimation);
storySpin.Children.Add(rotateXAnimation);
storySpin.Children.Add(rotateYAnimation);
storySpin.Children.Add(rotateAngleAnimation);
Storyboard.SetTargetProperty(translateXAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)");
Storyboard.SetTargetProperty(translateYAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)");
Storyboard.SetTargetProperty(transparentAnimation, "UIElement.Opacity");
Storyboard.SetTargetProperty(rotateXAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.CenterX)");
Storyboard.SetTargetProperty(rotateYAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.CenterY)");
Storyboard.SetTargetProperty(rotateAngleAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.Angle)");
Storyboard.SetTarget(translateXAnimation, element);
Storyboard.SetTarget(translateYAnimation, element);
Storyboard.SetTarget(transparentAnimation, element);
Storyboard.SetTarget(rotateXAnimation, element);
Storyboard.SetTarget(rotateYAnimation, element);
Storyboard.SetTarget(rotateAngleAnimation, element);
storySpin.Begin();
}
示例3: ArrangeInitialElement
private void ArrangeInitialElement(UIElement element, double panelCenterX, double panelCenterY)
{
element.Arrange(new Rect(panelCenterX, panelCenterY, element.DesiredSize.Width, element.DesiredSize.Height));
}
示例4: ArrangeExpandElement
private void ArrangeExpandElement(int idx, UIElement element,
double panelCenterX, double panelCenterY,
double elementCenterX, double elementCenterY,
double destX, double destY)
{
element.Arrange(new Rect(panelCenterX, panelCenterY, element.DesiredSize.Width, element.DesiredSize.Height));
var transGroup = element.RenderTransform as TransformGroup;
Transform translateTransform, rotateTransform;
if (transGroup == null)
{
element.RenderTransform = transGroup = new TransformGroup();
translateTransform = new TranslateTransform();
rotateTransform = new RotateTransform() { CenterX = elementCenterX, CenterY = elementCenterY };
transGroup.Children.Add(translateTransform);
transGroup.Children.Add(rotateTransform);
}
else
{
translateTransform = transGroup.Children[0] as TranslateTransform;
rotateTransform = transGroup.Children[1] as RotateTransform;
}
element.RenderTransformOrigin = new Point(0.5, 0.5);
//if (i != 0) continue;
var aniDuration = AnimationDuration + TimeSpan.FromSeconds(AnimationDurationStep * idx);
var storySpin = new Storyboard();
var translateXAnimation = new DoubleAnimation() { From = 0, To = destX - panelCenterX, Duration = aniDuration };
var translateYAnimation = new DoubleAnimation() { From = 0, To = destY - panelCenterY, Duration = aniDuration };
var transparentAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = aniDuration };
var rotateXAnimation = new DoubleAnimation() { From = 0, To = destX - panelCenterX, Duration = aniDuration };
var rotateYAnimation = new DoubleAnimation() { From = 0, To = destY - panelCenterY, Duration = aniDuration };
var rotateAngleAnimation = new DoubleAnimation() { From = 0, To = 720, Duration = aniDuration };
storySpin.Children.Add(translateXAnimation);
storySpin.Children.Add(translateYAnimation);
storySpin.Children.Add(transparentAnimation);
storySpin.Children.Add(rotateXAnimation);
storySpin.Children.Add(rotateYAnimation);
storySpin.Children.Add(rotateAngleAnimation);
Storyboard.SetTargetProperty(translateXAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)");
Storyboard.SetTargetProperty(translateYAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)");
Storyboard.SetTargetProperty(transparentAnimation, "UIElement.Opacity");
Storyboard.SetTargetProperty(rotateXAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.CenterX)");
Storyboard.SetTargetProperty(rotateYAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.CenterY)");
Storyboard.SetTargetProperty(rotateAngleAnimation, "(UIElement.RenderTransform).(TransformGroup.Children)[1].(RotateTransform.Angle)");
Storyboard.SetTarget(translateXAnimation, element);
Storyboard.SetTarget(translateYAnimation, element);
Storyboard.SetTarget(transparentAnimation, element);
Storyboard.SetTarget(rotateXAnimation, element);
Storyboard.SetTarget(rotateYAnimation, element);
Storyboard.SetTarget(rotateAngleAnimation, element);
storySpin.Begin();
}
示例5: ArrangeChild
private void ArrangeChild(UIElement child, Size size)
{
var topLeft = new Point(
(size.Width - child.DesiredSize.Width) / 2,
(size.Height - child.DesiredSize.Height) / 2
);
child.Arrange(new Rect(topLeft, child.DesiredSize));
}