collectionviewsource

How to handle a CompositeCollection with CollectionView features?

匆匆过客 提交于 2019-12-19 07:28:31
问题 Is there a way to get notified when CompositeCollection's current location changes? I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed. 回答1: You can detect when the current item has changed by monitoring the ICollectionView.CurrentChanged event of your CollectionView. The following code works for me: CompositeCollection cc = new CompositeCollection(); cc.Add(new CollectionContainer { Collection = new string[] { "Oh No!", "Fie" } }); cc.Add(new

SelectedItem set to first item with CollectionViewSource

試著忘記壹切 提交于 2019-12-18 05:03:57
问题 I have a view databound through mvvm light to a viewmodel in my WP7 project. The view contains a Listbox with following settings: <ListBox x:Name="StationList" ItemsSource="{Binding StationList}" SelectedItem="{Binding SelectedStation, Mode=TwoWay}" > The StationList is a ObservableCollection. Now when the view gets loaded, everything looks great! The list is shown and NO item is selected! But when I change the XAML to: <ListBox x:Name="StationList" ItemsSource="{Binding Source=

CollectionViewSource in windows metro app

不想你离开。 提交于 2019-12-14 03:46:13
问题 I have a collection, for which i require 3 different views 1. All data of collection 2. Grouped data (grouping criteria will be modified during application lifecycle ) 3. Filtered data (filter criteria will be modified during application lifecycle) What i want is that all views should bind to same collection so that any change to collection should be synced to all the views. With WPF, this can be achieved using CollectionViewSource. In Modern UI apps, CollectionViewSource still exists, but

Why does this CollectionViewSource not sort on the enum's ToString() result?

我只是一个虾纸丫 提交于 2019-12-12 22:58:01
问题 I have a view model that is used to produce items for an ItemsControl : public class PermissionItemViewModel { public PermissionsEnum Permission {get; set;} } The enum itself is defined in a way that the list is not naturally in alphabetical order, and when the control renders, the items are in the same order as the enum definition. In my view, I am trying to define a CollectionViewSource and make it sort those items by what would essentially be myEnumValue.ToString() . Instead, the sort

Binding a CollectionViewSource to ObservableCollection

房东的猫 提交于 2019-12-12 08:46:03
问题 Cannot bind the CollectionViewSource DocProps is a public property public ObservableCollection<DocProp> DocProps1 DataContext is self DataContext="{Binding RelativeSource={RelativeSource self}}" This works <ListBox Grid.Row="0" Grid.Column="0" ItemsSource="{Binding Path=DocProps1}"> I cannot wire up a CollectionViewSource to sort This does not even get DocProps1 <ListBox Grid.Row="0" Grid.Column="0"> <ListBox.ItemsSource> <Binding> <Binding.Source> <CollectionViewSource Source="{Binding Path

Accessing the first item in a CollectionViewSource containing multithreaded ObservableCollections

拜拜、爱过 提交于 2019-12-12 04:07:35
问题 As part of my attempt to fix my other problem regarding odd disabling, I tried to just updating the bound ObservableCollection instead of replacing the whole thing every few seconds. Obviously it gives an error since the event can't modify it. So, I created a multithreaded one based on this link. public class MTObservableCollection<T> : ObservableCollection<T> { public override event NotifyCollectionChangedEventHandler CollectionChanged; protected override void OnCollectionChanged

How to obtain Multi-level hierarchy with CollectionViewSource to bind to Semantic Zoom in Windows 8.1

非 Y 不嫁゛ 提交于 2019-12-12 03:25:32
问题 I have a Windows 8.1 Application in which I am trying to achieve 3 levels of Hierarchy with CollectionViewSource and then Bind it to my Semantic Zoom My model class looks as follows class Transaction { string id {get; set;} string name {get; set;} DateTimeOffset date {get; set; } Sample value of this model could be as follows [1, Food, 31/08/2014] [2, Movie, 15/08/2014] [3, Medicine, 20/07/2014] [4, GameConsole, 02/07/2014] [5, MobileBill, 18/06/2014] [4, Tv, 06/06/2014] I want to display

Dynamically create a treeview in windows phone 8 from Json data

落爺英雄遲暮 提交于 2019-12-12 02:13:22
问题 I am trying to create a Treeview dynamically in Windows Phone 8 from the json response from my server. This json response is nested to nested like a question asked in stackoverflow. I am very confused what approach me should use, i have deseriazlied my json object but how and where to map on xaml page ? Please suggest me what Data Structure should me use Treeview / ExpanderView / CollectionViewSource or any other Data Sturcture. My json is like following >Peter - - >user1 - - >user2 - -

Using CollectionViewSource in an ItemsControl nested inside an ItemsControl

我与影子孤独终老i 提交于 2019-12-11 16:04:48
问题 I'm trying to use a CollectionViewSource in an ItemsControl that is nested inside another ItemsControl . I have no XAML warnings/errors, but the data is not displayed. If I bind the ItemsSource property directly to the ObservableCollection , there is no problem displaying the items. My ViewModel is basically a collection nested inside another collection. XAML <UserControl x:Class="View" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

WPF Paged CollectionViewSource

天涯浪子 提交于 2019-12-11 15:45:35
问题 I have a WPF ListBox that I would like to add pagination to as it starts getting slow with a bunch of items. My problem is that I use the Grouping, Sorting, and Filtering. That means if I were to limit the data with the LINQ Skip() and Take() methods or using something like a paginated ObservableCollection the grouping and sorting would be wrong because it would only be applied to the first page of data. Filtering would be even worse because it would just filter the data displayed in the