or
| //_availableOnBoardSalesProducts is of the type ObservableCollection<Products> |
| gridFood.ItemsSource = _availableOnBoardSalesProducts; |
| myListBox.ItemsSource = _availableOnBoardSalesProducts; |
| //Add an item to the ObservableCollection works fine in the RadDataGrid |
| private void Button_Click(object sender, RoutedEventArgs e) |
| { |
| _availableOnBoardSalesProducts.Add(new OnboardSalesService.Products() { Price = 10m, Description = "MyDesc", Category = "MyCat" }); |
| } |
| //But applying a filter only works fine for the standard ListBox - not for the RadDataGrid |
| private void Button_Click_1(object sender, RoutedEventArgs e) |
| { |
| ICollectionView view = CollectionViewSource.GetDefaultView(gridFood.ItemsSource); |
| if (view.Filter == null) |
| { |
| view.Filter = delegate(object item) |
| { |
| bool result = ((OnboardSalesService.Products)item).Price == 10m; |
| return result; |
| }; |
| } |
| else |
| { |
| view.Filter = null; |
| } |
| } |
oRadPane.MinHeight = 600; oRadPane.MinWidth = 600; oRadPane.MakeFloatingDockable();