Catel + Orchestra MahApps - Property 'Owner' is not found on the object

291 views Asked by At

I'm using Catel + Orchestra.MahApps to build my application.

I'm trying to get custom Dialog working, and right now I'm stuck.

I have created 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>

Then I'm trying to show it from my ViewModel like this:

var uiservice = ServiceLocator.Default.ResolveType<IUIVisualizerService>();
var showDialog = uiservice.ShowDialog<NewPhotoWindowViewModel>();
if (showDialog == true)
{
    ...
}    

The result is that: - Error in Catel logs: Property 'Owner' is not found on the object 'NewPhotoWindow', probably the wrong field is being mapped - Dialog shows but without content - it automatically returns true as dialogResult

I have tried with multiple IUIVisualizerService methods: Show/ShowDialog and also with async. Always same problem.

Am I doing something wrong?

1

There are 1 answers

2
Geert van Horrik On

If I remember correctly, all the dialogs inside MahApps.Metro are async. This means you should use the async methods of the IUIVisualizerService to show the dialogs.