This is a migrated thread and some comments may be shown as answers.

Two grids bound to the same ListViewCollection synchronize selection

1 Answer 13 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 04 Dec 2013, 06:43 PM
Hi. I have a very simple for with 2 grids:

<Grid Margin="0,165,0,0">
    <telerik:RadGridView Margin="0,-155,0,307" x:Name="Grid1"/>
    <telerik:RadGridView Height="293" VerticalAlignment="Bottom" x:Name="Grid2"/>
</Grid>


I bound both grids to the same ListViewCollection:

private readonly ObservableCollection<Tuple<string, string>> _data = new ObservableCollection<Tuple<string, string>>();
private ListCollectionView _dataView;
....
    this.Loaded += (sender, args) =>
    {
        for (int i = 0; i < 10; i++)
        {
            _data.Add(Tuple.Create("row" + i, "value" + i));   
        }
 
        _dataView = new ListCollectionView(_data);
 
        Grid1.ItemsSource = _dataView;
        Grid2.ItemsSource = _dataView;
    };

When I select a row on one of the grid, the matching row gets selected on the 2nd grid. Why is this happening? This behavior does not happen when setting ItemsSource property to the underlying collection, only when using ListViewCollection. This is a very simple example that shows the basic issue I am trying to figure out in a much larger application where using underlying collection is not possible. If anyone knows why this is happening I would love to understand (and hopefully fix).

You can download the project showing a problem here WpfApplication1

Thanks
   

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 05 Dec 2013, 09:46 AM
Hello,

Please set IsSyncronizedWithCurrentItem="False" for RadGridView:
<telerik:RadGridView Height="293" VerticalAlignment="Bottom" x:Name="Grid2" IsSynchronizedWithCurrentItem="False"/>


Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or