我正在使用Catel + Orchestra.MahApps来构建我的应用程序。
我试图让自定义对话框工作,但现在我被卡住了。
我已经创建了SimpleDataWindow:
<orchestra:SimpleDataWindow x:Class="OrtMan.ViewModule.Photos.Views.NewPhotoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:catel="http://catel.codeplex.com"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:orchestra="https://github.com/orcomp/orchestra"
xmlns:viewModels="clr-namespace:OrtMan.ViewModule.Photos.ViewModels"
d:DataContext="{d:DesignInstance viewModels:NewPhotoWindowViewModel}"
mc:Ignorable="d">
<Grid>
<TextBlock Text="aaa" />
</Grid>
</orchestra:SimpleDataWindow>然后,我尝试从我的ViewModel中显示它,如下所示:
var uiservice = ServiceLocator.Default.ResolveType<IUIVisualizerService>();
var showDialog = uiservice.ShowDialog<NewPhotoWindowViewModel>();
if (showDialog == true)
{
...
} 结果是:-目录日志中的错误:Property 'Owner' is not found on the object 'NewPhotoWindow', probably the wrong field is being mapped -对话框显示但没有内容-它自动将true作为dialogResult返回
我尝试过多种IUIVisualizerService方法: Show/ShowDialog和async。总是同样的问题。
我做错了什么吗?
发布于 2015-06-17 19:28:15
如果我没记错的话,MahApps.Metro中的所有对话框都是异步的。这意味着您应该使用IUIVisualizerService的异步方法来显示对话框。
https://stackoverflow.com/questions/30872183
复制相似问题