我正在开发一个 windows phone 8.1 silverlight 应用程序,我想在我的页面之间提供简单的导航转换。
我在 Nuget 上找到了 Windows Phone Toolkit。不幸的是,转换服务的导航转换不起作用。我究竟做错了什么?(我使用 Caliburn Micro 作为 mvvm 框架)
引导程序.cs
public sealed class Bootstrapper : PhoneBootstrapperBase
{
public PhoneContainer Container { get; set; }
public Bootstrapper()
{
StartRuntime();
}
protected override void Configure()
{
Container = new PhoneContainer();
Container.RegisterPhoneServices(RootFrame);
Container.Singleton<MainViewModel>()
AddCustomConventions();
}
static void AddCustomConventions()
{
//ellided
}
protected override object GetInstance(Type service, string key)
{
return Container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return Container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
Container.BuildUp(instance);
}
protected override PhoneApplicationFrame CreatePhoneApplicationFrame()
{
return new TransitionFrame();
}
}
主视图.xaml
...
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
...
<Grid x:Name="LayoutRoot">
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
...
</Grid>
应用程序.xaml.cs
public sealed partial class App : Application
{
public static PhoneApplicationFrame RootFrame { get; private set; }
public App()
{
InitializeComponent();
if (!Debugger.IsAttached) return;
Application.Current.Host.Settings.EnableFrameRateCounter = false;
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
}
或者,在 windows phone SL 8.1 应用程序中提供导航转换的另一种方法是什么?