collectionviewsource

Binding with CollectionViewSource

浪尽此生 提交于 2019-12-06 03:22:14
问题 I am trying to implement some combo box sorting using CollectionViewSource. This combo box is actually part of a data template and is repeated in a list view. My first approach seemed to work (using CollectionViewSource) but all my combo boxes shared the same data context. This made it so whenever one of the other boxes was changed all the others changed to reflect - not a desired side effect. I decided to just pull back and try to implement a basic combo box (not inside a data template)

Two comboboxes with the same CollectionViewSource ItemSource update each other

徘徊边缘 提交于 2019-12-05 20:03:33
问题 On my ViewModel, I have 2 properties (both implement property changed notifications) : CountryOfIssue Nationality On my View, I have a CollectionViewSource pointing to a local instance of my Entity Framework context : <CollectionViewSource x:Key="cvsCountries" Source="{Binding LocalContext.Countries}" CollectionViewType="{x:Type ListCollectionView}"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="Name" /> </CollectionViewSource.SortDescriptions> <

WPF DataGrid Filtering - Refreshing CollectionViewSource Refreshing

限于喜欢 提交于 2019-12-04 23:46:52
问题 I want to know how I can refresh a CollectionViewSource when a button is clicked? So far I have <Window.Resources> <CollectionViewSource x:Key="cvsCustomers" Source="{Binding CustomerCollection}" Filter="CollectionViewSource_Filter" > </CollectionViewSource> </Window.Resources> Which creates the CollectionViewSource... <DataGrid HorizontalAlignment="Left" Height="210" Margin="47,153,0,0" VerticalAlignment="Top" Width="410" ItemsSource="{Binding Source={StaticResource cvsCustomers}}"

How to automatically update filter and/or sort order on CollectionViewSource, when an individual item's property changes?

可紊 提交于 2019-12-04 17:58:03
问题 Ok, so this question is related to Windows Phone 7/Silverlight (updated WP7 Tools, Sept 2010), specifically filtering an underlying ObservableCollection<T> . In mucking about with the WP7 template Pivot control application, I've run into an issue whereby changing an underlying item in an ObservableCollection<T> , does not result in the on-screen ListBox being updated. Basically, the sample app has two pivots, the first directly bound to the underlying ObservableCollection<T> , and the second

CollectionViewSource Use Question

断了今生、忘了曾经 提交于 2019-12-04 16:54:04
问题 I am trying to do a basic use of CollectionViewSource and I must be missing something because it is just not working. Here is my XAML: <Window.Resources> <CollectionViewSource Source="{Binding loc:MainVM.Instance.MapItems}" x:Key="MapCV"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="SourceProject" /> </CollectionViewSource.GroupDescriptions> </CollectionViewSource> </Window.Resources> <ListBox ItemsSource="{StaticResource MapCV}" HorizontalContentAlignment=

My CollectionViewSource is not picking up changes

空扰寡人 提交于 2019-12-04 15:13:00
I have a ListView which I'm binding to a CollectionViewSource in code behind with: collectionView = CollectionViewSource.GetDefaultView(TableView.ItemsSource); collectionView.SortDescriptions.Clear(); collectionView.SortDescriptions.Add(new SortDescription(propertyName, direction)); The TableView is the ListView, the propertyName is the name of the column I want sorted, and direction is either ascending or descending. The XAML has the following for ItemSource: ItemsSource="{Binding Rows}" The code behind has the following for the Rows: List<TableRow> rows; public List<TableRow> Rows { get {

Binding with CollectionViewSource

五迷三道 提交于 2019-12-04 07:37:10
I am trying to implement some combo box sorting using CollectionViewSource. This combo box is actually part of a data template and is repeated in a list view. My first approach seemed to work (using CollectionViewSource) but all my combo boxes shared the same data context. This made it so whenever one of the other boxes was changed all the others changed to reflect - not a desired side effect. I decided to just pull back and try to implement a basic combo box (not inside a data template) using inline xaml for specifying the CollectionViewSource (as opposed to creating the cvs as a static

Binding to CurrentItem in a ItemsControl

二次信任 提交于 2019-12-04 04:21:25
问题 The XAML below is basically trying to make a list of Button s (rendered from the Name property of objects in the Views collection in the current DataContext . When I click on a button the CurrentItem property of CollectionViewSource should change and the associated View should be displayed in a content presenter. OK. If I click in the ListBox in the XAML below it works exactly as desired. But, If I click a button in the UniformGrid (created by the items control) the CurrentItem property is

Two comboboxes with the same CollectionViewSource ItemSource update each other

寵の児 提交于 2019-12-04 02:56:38
On my ViewModel, I have 2 properties (both implement property changed notifications) : CountryOfIssue Nationality On my View, I have a CollectionViewSource pointing to a local instance of my Entity Framework context : <CollectionViewSource x:Key="cvsCountries" Source="{Binding LocalContext.Countries}" CollectionViewType="{x:Type ListCollectionView}"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="Name" /> </CollectionViewSource.SortDescriptions> </CollectionViewSource> Also on this page, I have two comboboxes used to set the values of CountryOfIssue and Nationality

WPF MVVM hierarchy selected item

你说的曾经没有我的故事 提交于 2019-12-03 21:09:58
问题 I am currently implementing the application that displays hierarchy using ListBoxes (please do not suggest using TreeView , ListBoxes are needed). It looks like that in the article: WPF’s CollectionViewSource (with source code). Classes: public class Mountains : ObservableCollection<Mountain> { public ObservableCollection<Lift> Lifts { get; } public string Name { get; } } public class Lift { public ObservableCollection<string> Runs { get; } } The example uses CollectionViewSource instances