本文整理汇总了C#中ITransition.BeginTransition方法的典型用法代码示例。如果您正苦于以下问题:C# ITransition.BeginTransition方法的具体用法?C# ITransition.BeginTransition怎么用?C# ITransition.BeginTransition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransition
的用法示例。
在下文中一共展示了ITransition.BeginTransition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoTransition
/// <summary>
/// Starts the specified transition.
/// </summary>
/// <param name="previousContent"></param>
/// <param name="newContent"></param>
/// <param name="transition"></param>
public void DoTransition(UIElement previousContent, UIElement newContent, ITransition transition)
{
Children.Clear();
Children.Add(previousContent);
if (transition.RequiresNewContentTopmost)
{
if (newContent != null) Children.Add(newContent);
transition.BeginTransition(this, Children.Cast<UIElement>().First(), Children.Cast<UIElement>().Last());
}
else
{
if (newContent != null) Children.Insert(0, newContent);
transition.BeginTransition(this, Children.Cast<UIElement>().Last(), Children.Cast<UIElement>().First());
}
}
示例2: DoTransition
public void DoTransition(object newContent, ITransition transition)
{
if(newContent == null)
{
Children.Clear();
return;
}
UIElement view;
if(ContentTemplate != null)
{
var template = ContentTemplate.LoadContent();
var fe = template as FrameworkElement;
if(fe != null)
fe.DataContext = newContent;
view = template as UIElement;
}
else view = newContent as UIElement;
if(view == null) return;
if (Children.Contains(view))
{
Children.Clear();
Children.Add(view);
return;
}
if(Children.Count > 0)
{
if(transition.RequiresNewContentTopmost)
{
Children.Add(view);
transition.BeginTransition(this, Children[0], view);
}
else
{
Children.Insert(0, view);
transition.BeginTransition(this, Children[1], view);
}
}
else
{
Children.Add(view);
TransitionEnded(transition, null, view);
}
}