我在网格中有一个网格。当我从父网格中选择一个项目时,它按预期工作。当我从子网格中选择一个项目时,首先它会绑定到所选项目,但是当我尝试执行某个操作(例如删除它)时,所选项目将变为空。这是我的代码:
<telerik:RadGridView name="parent"
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<telerik:RadGridView Name="child" ...
SelectedItem="{Binding Source={StaticResource myViewModel}, Path=SelectedChild, Mode=TwoWay}">
public Child SelectedChild
{
get
{
return selectedChild;
}
set
{
if (selectedChild!= value)
{
selectedChild= value;
NotifyPropertyChanged(nameof(SelectedChild));
}
}
}
internal void RemoveChild()
{
Child toberemoved = SelectedChild (this is where it returns null)
...
}