Hi,
I've got an error when i try to group my data by using the drag an drop of one of the columnheader. The only thing noticeable is there is two grids binded over one ListCollectionView because the same data are displayed in several place in my application.
I've made a little sample to reproduce the problem, just drag the Name colum header to the group panel or click on it to sort the datas.
I don't understand what's happen :(
- Ced -
I've got an error when i try to group my data by using the drag an drop of one of the columnheader. The only thing noticeable is there is two grids binded over one ListCollectionView because the same data are displayed in several place in my application.
I've made a little sample to reproduce the problem, just drag the Name colum header to the group panel or click on it to sort the datas.
I don't understand what's happen :(
- Ced -
public
class
MainViewModel : ViewModelBase
{
public
MainViewModel()
{
this
.Items =
new
ObservableCollection<Toto>();
this
.Items.Add(
new
Toto { Name =
"AAAA"
, Num = 0 });
this
.Items.Add(
new
Toto { Name =
"BBBB"
, Num = 1 });
this
.Items.Add(
new
Toto { Name =
"CCCC"
, Num = 1 });
this
.Items.Add(
new
Toto { Name =
"DDDD"
, Num = 0 });
this
.Items.Add(
new
Toto { Name =
"EEEE"
, Num = 1 });
this
.Items.Add(
new
Toto { Name =
"FFFF"
, Num = 0 });
this
.ItemsList =
new
ListCollectionView(
this
.Items);
}
private
ObservableCollection<Toto> Items {
get
;
set
; }
public
ListCollectionView ItemsList {
get
;
private
set
; }
}
public
class
Toto : ViewModelBase
{
private
string
name;
public
string
Name
{
get
{
return
name; }
set
{ name = value;
this
.RaisePropertyChanged(
"Name"
); }
}
private
bool
isSelected;
public
bool
IsSelected
{
get
{
return
isSelected; }
set
{ isSelected = value;
this
.RaisePropertyChanged(
"IsSelected"
); }
}
private
int
num;
public
int
Num
{
get
{
return
num; }
set
{ num = value; }
}
}
<
Window
x:Class
=
"MvvmLight1.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"300"
Width
=
"400"
>
<
Window.Resources
>
<
ResourceDictionary
>
<
Style
TargetType
=
"{x:Type telerik:GridViewRow}"
x:Uid
=
"Style_6"
>
<
Setter
x:Uid
=
"Setter_19"
Property
=
"IsSelected"
Value
=
"{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
/>
<
Style.Triggers
>
<
Trigger
x:Uid
=
"Trigger_3"
Property
=
"IsSelected"
Value
=
"True"
>
<
Setter
x:Uid
=
"Setter_20"
Property
=
"Background"
Value
=
"{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
</
ResourceDictionary
>
</
Window.Resources
>
<
StackPanel
>
<
Grid
x:Name
=
"LayoutRoot"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
telerik:RadGridView
AutoGenerateColumns
=
"true"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
Name
=
"Grid1"
SelectionMode
=
"Extended"
ScrollViewer.IsDeferredScrollingEnabled
=
"True"
EnableRowVirtualization
=
"True"
RowDetailsVisibilityMode
=
"Collapsed"
ItemsSource
=
"{Binding ItemsList}"
/>
<
telerik:RadGridView
Grid.Column
=
"1"
AutoGenerateColumns
=
"true"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
Name
=
"Grid2"
SelectionMode
=
"Extended"
ScrollViewer.IsDeferredScrollingEnabled
=
"True"
EnableRowVirtualization
=
"True"
RowDetailsVisibilityMode
=
"Collapsed"
ItemsSource
=
"{Binding ItemsList}"
/>
</
Grid
>
</
StackPanel
>
</
Window
>