collectionviewsource

WPF CollectionViewSource in Custom Control misuse ?

Should you use CollectionViewSource in the WPF Custom Control's code behind? I'am asking because the CollectionViewSource.GetDefaultView(SOURCE) with .Filter set changes the view so that all instances of the Control have the same view. Doesn't it mean, that in the Custom Control's code behind, you should avoid use of CollectionViewSou...

CollectionViewSource is filtered?

What's the easiest way to know if the view is currently filtered or not? I want a clearAll type of command that is only is displayed when there is something to clear. Thanks! Berryl ...

WPF: CollectionViewSource - uneven grouping

Hi! Im using the WPF-Toolkit DataGrid with an CollectionViewSource as Source. With PropertyGroupDescriptions I can create and display groups in the Grid. My problem is that i cannot create "uneven" groups, like: A A.A A.B B B.A B.B B.B.A B.B.B C D I want some groups that are deeper than other, and some, that are only elements ...

WPF DataBinding, CollectionViewSource, INotifyPropertyChanged

First time when I tried to do something in WPF, I was puzzled with WPF DataBinding. Then I studied thorougly next example on MSDN: http://msdn.microsoft.com/en-us/library/ms771319(v=VS.90).aspx Now, I quite understand how to use Master-Detail paradigm for a form which takes data from one source (one table) - both for master and detailed...

WPF: Bind/Apply Filter on Boolean Property

I want to apply a filter to a ListBox accordingly to the IsSelected property of a CheckBox. At the moment I have something like this. XAML <CheckBox Name="_filterCheckBox" Content="Filter list" Checked="ApplyFilterHandler"/> <ListBox ItemsSource="{Binding SomeItems}" /> CodeBehind public ObservableCollection<string> SomeItems { ...

Lazy/deferred loading of a CollectionViewSource?

When you create a CollectionViewSource in the Resources section, is the set Source loaded when the resources are initalized (i.e. when the Resources holder is inited) or when data is bound? Is there a xamly way to make a CollectionViewSource lazy-load? deferred-load? explicit-load? ...

WPF - Custom sorting logic for groups using CollectionViewSource

I have a list of "stuff" which needs to be filtered then displayed in a grouped and sorted manner. The data needed to calculate the grouping and sorting order is not available as simple properties - there needs to be some work done in code to calculate the order and groups. CollectionViewSource lets me define custom filter and sort logi...

Get notified of DataContext changed in a WPF Resource

Hi all: I'm having an annoying problem with WPF binding. Basically, I declare a FrameworkElement in my UserControl's resources, but that item doesn't seem to get notified when the DataContext of the parent UserControl changes. Basically, in my UserControl I have a Popup in the ItemTemplate for an ItemsControl. In that Popup, I needed...

WPF ListView groups repeat column headers

Is there a way to repeat the column headers inside each group of a ListView.GridView when using a grouped CollectionViewSource as the source of the ListView? I am using the example at http://msdn.microsoft.com/en-us/library/ms754027.aspx which uses an Expander control to display each group. I would like the column headers to appear in...

How to Collapse / Expand multiple Expander controls depending on Group name in WPF?

What I want to achieve: To collapse or expand all Expanders that share the same group name within a group style. We have a ListBox and another ListBox nested inside it to display child items. The child items ItemsSource is bound to a CollectionView with Group descriptions attached. The group item template is quite simple: <Expander Is...

Is there a xamly way to populate StaticResource at runtime?

I would actually prefer using a DynamicResource in this context, but it's impossible: <Page.Resources> <CollectionViewSource x:Key="CategoriesCollection" Source="{Binding Context.CatsList, Source={x:Static Application.Current}}"/> <DataGridComboBoxColumn Header="Category" ItemsSource="{Binding Source={StaticResource Cate...

Grouping with collectionviewsource based on 2 columns

Hi I've a collection with itemname and header, and I've to group based on header, and if the header is empty the group style must be a button, or else it should give expander and the itemnames as its content. {itemname="cadbury" header="choclates"} {itemname="5 star" header="choclates"} {itemname="Flapjack" header=""} {itemanem="ford" h...

Binding a CollectionViewSource within a DataTemplate

'ContentTemplate' is a DataTemplate that displays an object which has a member 'FooList' (an ObservableCollection). <DataTemplate x:Key="ContentTemplate"> <ListBox ItemsSource="{Binding Path=FOO}"> ... </ListBox> </DataTemplate> I need to be able to filter that FooList using a CollectionViewSource. This is usually been...

Is Silverlight's CollectionViewSource thread-safe?

I am trying to figure this out, given the following code, does the Refresh() need to occur on the UI thread? It seems to work, and I am wondering if the CollectionViewSource is actually a thread-aware / safe object? It definately has properties and methods to support calling on the correct thread, just not sure if that is left up to th...

How to get Items count from CollectionViewSource?

I am using CollectionViewSource to filter the records displayed in a ListBox. The xaml follows. <Window x:Class="WPFStarter.ListBoxItemsFilter.ListBoxFilterUsingCollectionViewSource" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name=...

CollectionViewSource and sorting (Danish alphabet)

Hello, I would like to sort some objects that have a Name property. These objects are stored in CollectionViewSource. I add sorting description in the following way: MyCollectionViewSource.View.SortDescriptions.Add(new SortDescription("Name"),direction)); where direction is Ascending/Descending. Everything works fine except one case...

Grouping items in a combobox

I have a listview that contains two types of objects, single and multiple. The single is a ordinary textblock while the multiple is a combobox with items. I'm trying to group the items in the combobox without success. Is it possible? Or should i go for a different approach? What i'm trying to achieve: [Combobox v] [Header ] [...

CollectionViewSource sorting only the first time it is bound to a source

I'm using a DataGrid bound to a CollectionViewSource (players), itself bound to the currently selected item of a ListBox (levels), each item containing a collection to be sorted/displayed in the DataGrid: <ListBox Name="lstLevel" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" /> ... <!-- DataGrid sou...

WPF: After adding a new row why aren't my bound controls updating?

I'm using wpf drag and drop databinding to datasets. I generate a new datatable row using the AddNew method of the BindingListCollectionView. I set values on the new row and call CommitNew on the BindingListCollectionView. I expect to see my assigned values in the bound controls but they are all blank. If I save the changes to the databa...

Collection View Source and LINQ to SQL

Hi, I am trying to bind data in my WPF Application using CollectionViewSource and LINQ to SQL. I have the following code in my XAML <dbml:VendorsDataContext x:Key="vendorAddress1"/> <CollectionViewSource x:Key="addressViewSource1" Source="{Binding Path = tblVendor_Address ,Source={StaticResource ...