private void TableGenerator_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { DataGrid.Columns.Clear(); DataGrid.ItemsSource = null; if (_aktualnyVystup != null) { _aktualnyVystup.VystupSpracovany -= ModelOnVystupSpracovany; } if (Model == null && !(DataContext is IVystup)) { _aktualnyVystup = null; return; } _aktualnyVystup = Model?.Vystup ?? DataContext as IVystup; _aktualnyVystup.VystupSpracovany += ModelOnVystupSpracovany; if (_aktualnyVystup.ParametrePreVystup == null || !_aktualnyVystup.ParametrePreVystup.Any()) { _aktualnyVystup.SpustiVystup(); } FilterInput.Children.Clear(); if (_aktualnyVystup.ParametrePreVystup != null) { foreach (var parameter in _aktualnyVystup.ParametrePreVystup) { var label = this.DajLabel(parameter); var inputBox = this.DajInputBox(parameter); FilterInput.Children.Add(label); FilterInput.Children.Add(inputBox); } } else { Filter.Visibility = Visibility.Hidden; } Filter.Visibility = FilterInput.Children.Count > 0 ? Visibility.Visible : Visibility.Collapsed; }
private void SpustiFilter(object sender, RoutedEventArgs e) { _aktualnyVystup.SpustiVystup(); }