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

SelectedItem set to null on DC-Change

1 Answer 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 20 Dec 2011, 10:43 AM
Dear Support,

using the RadGridView inside a DataTemplate, the bound SelectedItem becomes null in the first VM
after changing the VM to a second, different, VM of the same type.

  <ContentPresenter Content="{Binding CurrentContentViewModel}">
            <ContentPresenter.Resources>
                <ResourceDictionary>
                    <DataTemplate DataType="{x:Type local:ContentViewModel}">
                        <telerik:RadGridView ItemsSource="{Binding Items}"
                                             SelectedItem="{Binding SelectedItem}" />
                        <!--<ListView ItemsSource="{Binding Items}"
                                  SelectedItem="{Binding SelectedItem}" />-->
                    </DataTemplate>
                </ResourceDictionary>
            </ContentPresenter.Resources>
        </ContentPresenter>

Alternatively i tried ListView, which behaves as expected.

Is this a bug or am I doing wrong?

Find here a solution that reproduces this behaviour.

TestRadGridViewSelectedItem.zip

Version is: 2011.3.1116.40 / Runtime is v4.0.30319

Thanks Martin

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 23 Dec 2011, 08:36 AM
Hi Martin,

I admit that there is a different behavior compared to DataGrid, but unfortunately in order to support some features (as grouping) we need to clear SelectedItem when data source is changed.

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or