1 Flashcards
1
Q
Scop: seteaza Grid DataContext
Se da:
MainViewModel
Se cere:
Seteaza Grid DataContext direct in XAML
A
Pasi:
- Creeaza Window.Resources
se instantiaza MainViewModel x:Key=”_viewModel”
- In Grid seteaza DataContext=”{StaticResource _viewModel}”
2
Q
Access Resources xaml from code behind
Se da:
in XAML, Window.Resources este instantiat MainWindowViewModel cu x:Key=”_viewModel”
Se cere:
In code behind, cum se obtine o referinta la _viewModel
A
(MainWindowViewModel)this.Resources[“_viewModel”];
3
Q
Se da:
event Loaded=”Window_Loaded” …
private async void Window_Loaded
Se cere:
Cum se foloseste Dispatcher.BeginInvoke
A
await Dispatcher.BeginInvoke (new Action( () => { _viewModel.LoadStateCodes;}),
DispatcherPriority.Background);
4
Q
A