using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace XLAB2 { public partial class AccountingBookDirectoryWindow : Window { private readonly AccountingBookDirectoryWindowViewModel _viewModel; internal AccountingBookDirectoryWindow(DocumentNumberDirectoryService documentNumberDirectoryService) { InitializeComponent(); _viewModel = new AccountingBookDirectoryWindowViewModel( documentNumberDirectoryService, new DialogService(this, documentNumberDirectoryService)); DataContext = _viewModel; } private void DataGridRow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { var row = sender as DataGridRow; if (row != null) { row.IsSelected = true; row.Focus(); } } private void Window_Loaded(object sender, RoutedEventArgs e) { _viewModel.Initialize(); } } }