本文整理汇总了C#中System.Windows.Controls.Page.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# Page.Layout方法的具体用法?C# Page.Layout怎么用?C# Page.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Page
的用法示例。
在下文中一共展示了Page.Layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetCurrent
internal Task SetCurrent(Page page, bool animated, bool popping = false, Action completedCallback = null)
{
var tcs = new TaskCompletionSource<bool>();
if (page == _currentDisplayedPage)
{
tcs.SetResult(true);
return tcs.Task;
}
if (!animated)
tcs.SetResult(true);
page.Platform = this;
if (GetRenderer(page) == null)
SetRenderer(page, CreateRenderer(page));
page.Layout(new Rectangle(0, 0, _renderer.ActualWidth, _renderer.ActualHeight));
IVisualElementRenderer pageRenderer = GetRenderer(page);
if (pageRenderer != null)
{
((FrameworkElement)pageRenderer.ContainerElement).Width = _renderer.ActualWidth;
((FrameworkElement)pageRenderer.ContainerElement).Height = _renderer.ActualHeight;
}
Page current = _currentDisplayedPage;
UIElement currentElement = null;
if (current != null)
currentElement = (UIElement)GetRenderer(current);
if (popping)
{
ITransition transitionOut = null;
if (current != null)
{
if (animated)
transitionOut = _backwardOutTransition.GetTransition(currentElement);
else
_renderer.Children.Remove(currentElement);
}
var pageElement = (UIElement)GetRenderer(page);
if (animated)
{
transitionOut.Completed += (s, e) =>
{
transitionOut.Stop();
_renderer.Children.Remove(currentElement);
UpdateToolbarTracker();
_renderer.Children.Add(pageElement);
ITransition transitionIn = _backwardInTransition.GetTransition(pageElement);
transitionIn.Completed += (si, ei) =>
{
transitionIn.Stop();
if (completedCallback != null)
completedCallback();
tcs.SetResult(true);
};
transitionIn.Begin();
};
transitionOut.Begin();
}
else
{
UpdateToolbarTracker();
_renderer.Children.Add(pageElement);
if (completedCallback != null)
completedCallback();
}
}
else
{
ITransition transitionOut = null;
if (current != null)
{
if (animated)
transitionOut = _forwardOutTransition.GetTransition(currentElement);
else
_renderer.Children.Remove(currentElement);
}
if (animated)
{
if (transitionOut != null)
{
transitionOut.Completed += (o, e) =>
{
_renderer.Children.Remove(currentElement);
transitionOut.Stop();
UpdateToolbarTracker();
var element = (UIElement)GetRenderer(page);
_renderer.Children.Add(element);
ITransition transitionIn = _forwardInTransition.GetTransition(element);
//.........这里部分代码省略.........