在ReactiveUI,我跑在某一点这样的代码:
const string template = "<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:routing='using:ReactiveUI.Routing'>" +
"<routing:ViewModelViewHost ViewModel=\"{Binding}\" VerticalContentAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" IsTabStop=\"False\" />" +
"</DataTemplate>";
var theTemplate = XamlReader.Load(template);
在其它平台上,这个伟大工程(中xmlns
声明当然是不同的),但{的WinRT /地铁/ Windows应用商店},这将引发一个未指定的错误:
WinRT information: The type 'ViewModelViewHost' was not found. [Line: 1 Position: 253]
扭曲
但是,如果包括在页面上的虚拟资源:
<Page.Resources>
<DataTemplate x:Name="Foo">
<routing:ViewModelViewHost ViewModel="{Binding}" />
</DataTemplate>
</Page.Resources>
...那么它的作品! 是什么赋予了?