Binding to CollectionViewSource not working

2 posts, 0 answers
  1. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 06 Nov 2014 Link to this post

    I want to bind a RadGridView and a RadDataForm to the same collection of items and they should synchronize like in your WPF demo application. When I bind the ItemsSource property directly to my ICollectionView property in the ViewModel everything works fine. But when I create a CollectionViewSource bound to that property and use this resource as ItemsSource both controls do not show the data. Why is that not possible? I want to add sorting and grouping and CollectionViewSource seems to be the right way. Here's my code:

    01.<Window x:Class="WpfApplication1.MainWindow"
    04.        xmlns:telerik=""
    05.        Title="MainWindow">
    06.    <Window.Resources>
    07.        <CollectionViewSource x:Key="MySource" Source="{Binding ItemsView}" />
    08.    </Window.Resources>
    09.    <Grid>
    10.        <StackPanel>
    11.            <StackPanel Orientation="Horizontal" Height="200" Margin="10">
    12.                <!-- binding directly to property ItemsView in DataContext/ViewModel ... WORKING -->
    13.                <telerik:RadGridView AutoGenerateColumns="True" ItemsSource="{Binding ItemsView}" Width="200" />
    14.                <telerik:RadDataForm AutoGenerateFields="True" ItemsSource="{Binding ItemsView}" Width="200" />
    15.            </StackPanel>
    16.            <StackPanel Orientation="Horizontal" Height="200" Margin="10">
    17.                <!-- binding to CollectionViewSource ... NOT working -->
    18.                <telerik:RadGridView AutoGenerateColumns="True" ItemsSource="{Binding Source={StaticResource MySource}}" Width="200" />
    19.                <telerik:RadDataForm AutoGenerateFields="True" ItemsSource="{Binding Source={StaticResource MySource}}" Width="200" />
    20.            </StackPanel>
    21.        </StackPanel>
    22.    </Grid>
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 07 Nov 2014 Link to this post


    CollectionViewSource.View returns ICollectionView which is a valid Source collection for RadGridView. 
    Would it be possible for you to open a new support thread and send us a demo project illustrating the problem? You can take a look at this blog post for a reference on how to isolate an issue. 


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top