【发布时间】:2015-06-17 19:28:15
【问题描述】:
我正在使用 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)
{
...
}
结果是:
- Catel 日志中的错误:Property 'Owner' is not found on the object 'NewPhotoWindow', probably the wrong field is being mapped
- 对话框显示但没有内容
- 它会自动返回 true 作为 dialogResult
我尝试了多种IUIVisualizerService 方法:Show/ShowDialog 以及异步。总是同样的问题。
我做错了吗?
【问题讨论】:
标签: mahapps.metro catel