【问题标题】:Catel + Orchestra MahApps - Property 'Owner' is not found on the objectCatel + Orchestra MahApps - 在对象上找不到属性“所有者”
【发布时间】: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


    【解决方案1】:

    如果我没记错的话,MahApps.Metro 中的所有对话框都是异步的。这意味着您应该使用 IUIVisualizerService 的异步方法来显示对话框。

    【讨论】:

    • 就像我在问题中所说的,(“and also with async”),我尝试过异步方法,结果完全一样
    • 这可能是第一次机会例外。你试过继续吗? Orchestra 存储库中的示例应用程序也不适用于您?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-27
    相关资源
    最近更新 更多