Can I specify which Columns are editable in a WPF DataGrid?

后端 未结 4 894
Happy的楠姐
Happy的楠姐 2021-01-02 15:05

I have a WPF 4.0 DataGrid with AutoGenerated columns. I would like to only allow the user to edit the first column. Is there an easy way of doing this?

I was trying

4条回答
  •  爱一瞬间的悲伤
    2021-01-02 15:36

    I got it.... here's what I used:

    
        
    
    

    If you want, you can use Column.DisplayIndex instead of Column.Header

    I'm still not sure why the binding won't work directly and needs to be referenced by a RelativeSource, but at least it works :)

提交回复
热议问题