reactiveui中的xaml转换器错误
在Windows应用商店应用程序中尝试使用ReactiveUI的MVVM框架时,我遇到以下神秘错误:reactiveui中的xaml转换器错误,xaml,winrt-xaml,reactiveui,Xaml,Winrt Xaml,Reactiveui,在Windows应用商店应用程序中尝试使用ReactiveUI的MVVM框架时,我遇到以下神秘错误: Error: Converter failed to convert value of type 'ReactiveUI.RoutingState, ReactiveUI, Version=5.4.0.0, Culture=neutral, PublicKeyToken=null' to type 'IRoutingState'; BindingExpression: Path='Route
Error: Converter failed to convert value of type 'ReactiveUI.RoutingState, ReactiveUI,
Version=5.4.0.0, Culture=neutral, PublicKeyToken=null' to type 'IRoutingState';
BindingExpression: Path='Router' DataItem='MVVMTestWS.AppBootstrapper'; target element
is 'ReactiveUI.Xaml.RoutedViewHost' (Name='null'); target property is 'Router'
(type 'IRoutingState').
Xaml如下所示:
<Page
x:Class="MVVMTestWS.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MVVMTestWS"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Xaml="using:ReactiveUI.Xaml"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Xaml:RoutedViewHost Router="{Binding Router}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</Grid>
</Page>
public class AppBootstrapper : ReactiveObject, IScreen
{
public IRoutingState Router { get; private set; }
public AppBootstrapper(IMutableDependencyResolver dependencyResolver = null, IRoutingState testRouter = null)
{
Router = testRouter ?? new RoutingState();
dependencyResolver = dependencyResolver ?? RxApp.MutableResolver;
// Bind
RegisterParts(dependencyResolver);
// TODO: This is a good place to set up any other app
// startup tasks, like setting the logging level
LogHost.Default.Level = LogLevel.Debug;
// Navigate to the opening page of the application
Router.Navigate.Execute(new HomePageVM(this));
}
这个错误使我迷惑!路由器被清楚地声明为IRoutingState,我已经检查过它是否为null,并且我已经尽力确保它没有两个定义。web上有一些传言说WS-apps绑定到接口时遇到问题,但是按钮中的ICommand工作正常,我在同一个项目中测试了它
这是一个非常简单的WS-app,使用VS2013为Win 8.1构建。我正在使用5.4.0版本的ReactiveUI,如果这在这里有所不同的话。说到编写WS-apps,我是个新手。任何关于我做错了什么或我能做些什么来帮助调试的建议都会非常有用 电脑很奇怪。让它成为具体的类RoutingState,接口可能会在ReactiveUI 6中消失谢谢,Paul。不过,我不知道你的意思。IScreen要求有一个IRoutingState接口。我尝试了一种方法:我只是让Router成为具体的RoutingState类,然后让IScreen接口显式地实现IScreen.Router。在这种情况下,绑定发生在具体路由器上。然而,我仍然得到同样的错误。第一次机会异常是否揭示了有趣的事情?