相关疑难解决方法(0)

绑定到WPF DataGrid时,此视图不允许使用DataGrid版本的"EditItem"

我至少已经阅读了4个小时,并且似乎是列表类型,但我有一个情况:

具有集合属性的ObservableCollection.

我定义了第一个DataGrid,并在该部分中

<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <!-- second Datagrid here, binding to Level2 property of my Observable collection -->
    </DataTemplate>
<DataGrid.RowDetailsTemplate>
Run Code Online (Sandbox Code Playgroud)

一切顺利,屏幕上的所有内容都如我所料......但是:

  1. 如果尝试修改DataGrid1单元格,它允许我.
  2. 如果尝试修改DataGrid2单元格,它会抛出这个异常 'EditItem' is not allowed for this view

我错过了什么?

这是我的模特:

public partial class Level1
{
    public Level1()
    {
        this.Level2 = new HashSet<Level2>();
    }

    public decimal IdLevel1 { get; set; }
    public decimal IdLevel2 { get; set; }
    public string StrDescripcionTipoAsociado {get;set;}

    public virtual Level2 Level2{ get; set; }
}

public partial class Level2
{
    public decimal IdLevel1 { …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml datagrid

18
推荐指数
5
解决办法
3万
查看次数

标签 统计

c# ×1

datagrid ×1

wpf ×1

xaml ×1