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"
03.
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
04.
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
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
>
23.
</
Window
>