public RecipesWindow(IDbHandle dbCli) { InitializeComponent(); DbCli = dbCli; DataCollection = new CookingBookDataCollection(DbCli); MainGrid.DataContext = CookinBookDictionary.Instance.GetNames(MainWindow.SelectedLanguage); RecipeListViev.ItemsSource = DataCollection.GetFullRecipeList(); AllComponentsViev.ItemsSource = DataCollection.GetFullComponentList(); CollectionView RecipeViev = (CollectionView)CollectionViewSource.GetDefaultView(RecipeListViev.ItemsSource); RecipeViev.Filter = (item => (String.IsNullOrEmpty(RecipeFilterText.Text) ? true : ((item as Recipe).Name.IndexOf(RecipeFilterText.Text, StringComparison.OrdinalIgnoreCase) >= 0))); CollectionView ComponentViev = (CollectionView)CollectionViewSource.GetDefaultView(AllComponentsViev.ItemsSource); ComponentViev.Filter = (item => (String.IsNullOrEmpty(ComponentsFilterText.Text) ? true : ((item as Component).Name.IndexOf(ComponentsFilterText.Text, StringComparison.OrdinalIgnoreCase) >= 0))); }
public ComponentsWindow(IDbHandle dbCli) { InitializeComponent(); CookingBookLanguageSelect.ChangeLanuage(MainWindow.SelectedLanguage, this); DbCli = dbCli; Components = new CookingBookDataCollection(DbCli); ComponentsListViev.ItemsSource = Components.GetFullComponentList(); CollectionView ComponentViev = (CollectionView)CollectionViewSource.GetDefaultView(ComponentsListViev.ItemsSource); ComponentViev.Filter = ComponentFilter; }