如何默认导航屏幕? [英] How to naviagate screens by default?
问题描述
大家好,我们需要自动显示演示,需要让一个屏幕完成,下一个屏幕开始加载(以秒为间隔)。如何实现?
BTW,每个屏幕都可能包含动画。
当故事板完成但是不起作用时我使用以下内容:
void m_StoryboardSwitch_Completed( object 发件人, EventArgs e) {
NavigateToScreenAction navigateAction = 新 NavigateToScreenAction (); navigateAction.TargetScreen =
" AnimationScreens.Screen_1_2" ; }
但是,没有办法勾选SketchFlow动画的结束事件,所以我有使用StoryBoard。欢迎任何提示。
提前感谢您的建议,
元子
享受生活
使用行为进行操作(可能更容易):
右键单击对象和时间轴面板中的layoutroot,然后选择 - >导航到 - >您想要的画面
在对象和时间轴面板中选择新添加的行为
在属性面板中,找到触发器部分并单击新建
选择StoryboardCompletedTrigger
将故事板设置为你想要使用的人
用代码来做:第一轮Screen_1()
{
this.InitializeComponent();
var sb = this.Resources [" Storyboard1"] as System.Windows.Media.Animation.Storyboard;
sb.Completed + = new EventHandler(sb_Completed);
}
void sb_Completed(object sender,EventArgs e)
{
Microsoft.Expression.Prototyping.Services.PlayerContext.Instance.ActiveNavigationViewModel.NavigateToScreen(" WpfPrototype5Screens .Screen_2",true);
}
Hi All,
We need show the demo automatically, which need let one screen finishes, the next screen begin loading(with several seconds as interval). How to implement that?
BTW, each screen may contains animation.
I use the following when a storyboard finished, but doesn't work:
void m_StoryboardSwitch_Completed(object sender, EventArgs e)
{
NavigateToScreenAction navigateAction = new NavigateToScreenAction();
navigateAction.TargetScreen =
"AnimationScreens.Screen_1_2";
}
However, there is no way to hook the finish event of SketchFlow Animation, so I have to use StoryBoard. Any hint are welcome.
Thanks for your advice in advance,
Yuanzi
Enjoy life
To do it with behaviors (probably easier):
Right click layoutroot in the objects and timeline panel, and select -> navigate to -> the screen you want
Select the newly added behavior in the objects and timeline panel
In the properties panel, find the trigger section and click new
Select a StoryboardCompletedTrigger
Set the storyboard to the one you want to use
To do it with code:
public Screen_1() { this.InitializeComponent(); var sb = this.Resources["Storyboard1"] as System.Windows.Media.Animation.Storyboard; sb.Completed += new EventHandler(sb_Completed); } void sb_Completed(object sender, EventArgs e) { Microsoft.Expression.Prototyping.Services.PlayerContext.Instance.ActiveNavigationViewModel.NavigateToScreen("WpfPrototype5Screens.Screen_2", true); }
这篇关于如何默认导航屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!