These are chat archives for punker76/MahApps.Metro.SimpleChildWindow

15th
Sep 2017
Jan Karger ツ ☀
@punker76
Sep 15 2017 06:14
@fagenorn normaly not. Can you show me your code or is this on GitHub?
fagenorn
@fagenorn
Sep 15 2017 09:25
        private static readonly DependencyProperty WindowProperty = DependencyProperty.Register(
            "Window",
            typeof(ChildWindow),
            typeof(SelectedItemsList),
            new UIPropertyMetadata(null));

        public ChildWindow Window
        {
            private get => (ChildWindow)this.GetValue(WindowProperty);
            set => this.SetValue(WindowProperty, value);
        }

        private async void Add(object sender, RoutedEventArgs e)
        {
            var metroWindow = Application.Current.MainWindow as MetroWindow;
            await metroWindow.ShowChildWindowAsync(this.Window);
        }
The DependencyProperty is then binded to plain simpleChildWindow
The funny thing is, it only takes that long to load the first time it opens the child window, after that it's almost instantly even if a different child window is set for the DependencyProperty.
Jan Karger ツ ☀
@punker76
Sep 15 2017 10:55
@fagenorn why is your Window dep property private? I think for binding it should be public
public static readonly DependencyProperty WindowProperty = DependencyProperty.Register(
    "Window",
    typeof(ChildWindow),
    typeof(SelectedItemsList),
    new UIPropertyMetadata(null));

public ChildWindow Window
{
    get => (ChildWindow)this.GetValue(WindowProperty);
    set => this.SetValue(WindowProperty, value);
}
fagenorn
@fagenorn
Sep 15 2017 12:19
either seems to work for me, but even when set to public the load time is not imrpoved. I actually don't mind the loading, but I am trying to show ShowProgressAsync() while it's loading but it does't seem to show the dialog itself (only the black overlay) because it loads the child window on the same thread maybe?
Jan Karger ツ ☀
@punker76
Sep 15 2017 12:20
@fagenorn so, what are you loading which blocks the ui thread?
fagenorn
@fagenorn
Sep 15 2017 12:24
Only thing that is loading is await metroWindow.ShowChildWindowAsync(this.Window); I show the progress dialog before calling it, but it doesn't seem to show, only the black overlay.
Jan Karger ツ ☀
@punker76
Sep 15 2017 12:28
@fagenorn -> priv chat