Beispiel #1
0
        public static void ShowDialog <Tmodel, Tview>() where Tview : UserControl, new() where Tmodel : new()
        {
            var view = new Tview();

            view.DataContext = new Tmodel();
            mainWindow.MainContainer.Children.Clear();
            mainWindow.MainContainer.Children.Add(view);
        }
Beispiel #2
0
        public static UserControl GetView <Tmodel, Tview>() where Tmodel : new () where Tview : UserControl, new()
        {
            UserControl view;

            if (!Views.TryGetValue(typeof(Tmodel), out view))
            {
                view             = new Tview();
                view.DataContext = new Tmodel();
                Views.Add(typeof(Tmodel), view);
            }

            return(view);
        }