icollectionview

Filtering ObserverableCollection to display only certain items

我只是一个虾纸丫 提交于 2019-12-11 01:04:08
问题 I was following this link here: http://jacobmsaylor.com/?p=1270 but i'm having problems with it, trying to make tweaks to it <ListBox Name="PageList_ListBox" MouseDoubleClick="PageList_ListBox_OnMouseDoubleClick" Background="#FFC9C9C9" Margin="0,5,0,0" ItemsSource="{Binding PageCollection, ElementName=This}"> . public static ObservableCollection<MLBPage> _PageCollection = new ObservableCollection<MLBPage>(); public static ObservableCollection<MLBPage> PageCollection { get { return

wpf datagrid icollectionview sorting BUG?

大憨熊 提交于 2019-12-07 13:33:46
问题 maybe someone can help me? I have the following scenario: A simple view: <Window x:Class="DataGridSortBug.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <DockPanel> <StackPanel DockPanel.Dock="Top"> <Button Click="Button_Click">Refresh</Button> </StackPanel> <DataGrid ItemsSource="{Binding View}" /> </DockPanel> </Window> The code behind: public partial class

WPF ICollectionView Filtering

江枫思渺然 提交于 2019-12-06 04:51:04
问题 I've written a code for filtering items in ComboBox: My question is, how would you do that? I think that this solution with reflection could be very slow .. ICollectionView view = CollectionViewSource.GetDefaultView(newValue); view.Filter += this.FilterPredicate; private bool FilterPredicate(object value) { if (value == null) return false; if (String.IsNullOrEmpty(SearchedText)) return true; int index = value.ToString().IndexOf( SearchedText, 0, StringComparison.InvariantCultureIgnoreCase);

WPF Binding filtered ObservableCollection ICollectionView to Combobox

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 02:44:50
问题 I want to filter an ObservableCollection to a subset based on type (type AddPoint) and want it ordered ascending with no duplicates. My base class is ModelBase, w/ sub-classes AddPoint, Time, Repeat, etc... The ObservableCollection MotionSequenceCollection will be filled w/ those types in any order and some will be duplicates. I've tried several different times and shown them below in the ICollectionView Property that I 'pulled' from: Bind subset of collection. OBSERVABLE COLLECTION private

wpf datagrid icollectionview sorting BUG?

强颜欢笑 提交于 2019-12-05 18:39:14
maybe someone can help me? I have the following scenario: A simple view: <Window x:Class="DataGridSortBug.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <DockPanel> <StackPanel DockPanel.Dock="Top"> <Button Click="Button_Click">Refresh</Button> </StackPanel> <DataGrid ItemsSource="{Binding View}" /> </DockPanel> </Window> The code behind: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = new ViewModel(); } public

WPF ICollectionView Filtering

痴心易碎 提交于 2019-12-04 09:27:32
I've written a code for filtering items in ComboBox: My question is, how would you do that? I think that this solution with reflection could be very slow .. ICollectionView view = CollectionViewSource.GetDefaultView(newValue); view.Filter += this.FilterPredicate; private bool FilterPredicate(object value) { if (value == null) return false; if (String.IsNullOrEmpty(SearchedText)) return true; int index = value.ToString().IndexOf( SearchedText, 0, StringComparison.InvariantCultureIgnoreCase); if ( index > -1) return true; return FindInProperties(new string[] { "Property1", "Property2" }, value,

WPF Binding filtered ObservableCollection ICollectionView to Combobox

你说的曾经没有我的故事 提交于 2019-12-04 08:01:18
I want to filter an ObservableCollection to a subset based on type (type AddPoint) and want it ordered ascending with no duplicates. My base class is ModelBase, w/ sub-classes AddPoint, Time, Repeat, etc... The ObservableCollection MotionSequenceCollection will be filled w/ those types in any order and some will be duplicates. I've tried several different times and shown them below in the ICollectionView Property that I 'pulled' from: Bind subset of collection . OBSERVABLE COLLECTION private ObservableCollection<ModelBase> _motionSequenceCollection = new ObservableCollection<ModelBase>();

Convert Predicate<T> to Expression<Func<T, bool>>

浪尽此生 提交于 2019-12-04 05:49:04
Is possible to convert a Predicate<T> to Expression<Func<T, bool>> in some way? I would like to use the next IQueryable function using the filters of the my ICollectionView: public static System.Linq.IQueryable<TSource> Where<TSource>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<System.Func<TSource, bool>> predicate) Thanks In theory it is possible to convert a delegate 'back' to an expression, because you can request the emitted IL of a delegate, which gives you the information you need to transform it back. However, it's for a reason that neither LINQ to

Implementing ICollectionViewLiveShaping

自闭症网瘾萝莉.ら 提交于 2019-12-03 12:43:06
问题 How is ICollectionViewLiveShaping implemented for the purpose of filtering? Is it something like: public ICollectionView WorkersEmployed { get; set; } WorkersEmployed = new CollectionViewSource { Source = GameContainer.Game.Workers }.View; I'm not using GetDefaultView because I need multiple instances of filters on this collection. If it matters, GameContainer.Game.Workers is an ObservableCollection . ApplyFilter(WorkersEmployed); private void ApplyFilter(ICollectionView collectionView) {

Implementing ICollectionViewLiveShaping

馋奶兔 提交于 2019-12-03 02:27:47
Can anybody help me properly implement ICollectionViewLiveShaping for the purpose of filtering? I haven't found much useful documentation online regarding this issue. Here's what I have: public ICollectionView WorkersEmployed { get; set; } WorkersEmployed = new CollectionViewSource { Source = GameContainer.Game.Workers }.View; I'm not using GetDefaultView because I need multiple instances of filters on this collection. If it matters, GameContainer.Game.Workers is an ObservableCollection . ApplyFilter(WorkersEmployed); private void ApplyFilter(ICollectionView collectionView) { collectionView