Esempio n. 1
0
        public Task OpenWindow(IViewModel viewModel, bool showAppIcon)
        {
            var window = new ViewWindow
            {
                DataContext = viewModel
            };

            if (showAppIcon)
            {
                BindingOperations.SetBinding(window, Window.IconProperty, new Binding
                {
                    Source  = this,
                    Path    = new PropertyPath(nameof(AppIcon)),
                    IsAsync = true
                });
            }

            BindingOperations.SetBinding(window, Window.TitleProperty, new Binding
            {
                Source = this,
                Path   = new PropertyPath(nameof(AppName))
            });
            BindingOperations.SetBinding(window, Window.ResizeModeProperty, new Binding
            {
                Source = this,
                Path   = new PropertyPath(nameof(ResizeMode))
            });

            window.Show();

            return(window.Task);
        }