Hi i have a radgrid on one page and i am selecting an item and sending that item to another page, the item is getting selected but the problem is whenever the new view model is made it initializes my selected item value to null in first view model.
xaml.cs
<telerik:RadGridView Loaded="ItemGrid_Loaded" SelectionMode="Single" RowIndicatorVisibility="Collapsed" SelectionChanged="grdArticles_SelectionChanged" x:Name="grdArticles"
SelectedItem="{Binding SelectedItem"
IsReadOnly="True"
ItemsSource="{Binding ListArticles, Mode=OneWay}"
ShowColumnHeaders="False" Height="150" Width="400" AutoGenerateColumns="False" ShowGroupPanel="False" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Code}"
IsReadOnly="True" TextAlignment="Left"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
IsReadOnly="True" TextAlignment="Left"/>
<!--<telerik:GridViewColumn>
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<telerik:RadButton Content="?" Width="10"/>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewColumn>-->
</telerik:RadGridView.Columns>
</telerik:RadGridView>
my view model
public Item SelectedItem
{
get { return _selectedItem; }
set
{ _selectedItem=value;
OnPropertyChanged("Element1");
OnPropertyChanged("Element1");
}
}
My selectedItem is set to null once i move to another page
Typo ? Replace :
SelectedItem="{Binding SelectedItem"
With
SelectedItem="{Binding SelectedItem}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.