File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ protected override void OnStartup(StartupEventArgs e)
1616 base . OnStartup ( e ) ;
1717 this . DispatcherUnhandledException += AppDispatcherUnhandledException ;
1818
19- ( new ScreenGrid . Views . ScreenGridWindow ( ) ) . Show ( ) ;
19+ ( new Views . ScreenGridWindow
20+ {
21+ DataContext = new ViewModels . ScreenGridViewModel ( )
22+ } ) . Show ( ) ;
2023 }
2124
2225 private void CurrentDomainUnhandledException ( object sender , UnhandledExceptionEventArgs e )
Original file line number Diff line number Diff line change @@ -21,16 +21,11 @@ public ScreenGridWindow()
2121 // Making text sharp
2222 TextOptions . SetTextFormattingMode ( this , TextFormattingMode . Display ) ;
2323
24- // TODO: external ViewModel
2524 this . InitializeComponent ( ) ;
26- this . vm = new ViewModels . ScreenGridViewModel ( ) ;
27- this . DataContext = this . vm ;
2825 }
2926
3027 private ContextMenu mainMenu ;
3128
32- private ViewModels . ScreenGridViewModel vm ;
33-
3429 private void Window_Loaded ( object sender , RoutedEventArgs e )
3530 {
3631 this . CreateContextMenu ( ) ;
@@ -75,7 +70,7 @@ private void CreateContextMenu()
7570 }
7671
7772 menuItem . IsChecked = true ;
78- this . vm . GridMode = ( Models . Grids . GridType ) ( ( s as MenuItem ) . Tag ) ;
73+ ( this . DataContext as ViewModels . ScreenGridViewModel ) . GridMode = ( Models . Grids . GridType ) ( ( s as MenuItem ) . Tag ) ;
7974 } ;
8075
8176 this . mainMenu . Items . Add ( menuItem ) ;
You can’t perform that action at this time.
0 commit comments