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

后端 未结 4 868
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:38

    Each column has a IsReadOnly Property. Also, the whole DataGrid has the IsReadOnly as well [This does NOT affect the binding, just the ability of the user to edit the field]

    EDIT: Rushed an answer, sorry. I can only guess that you should NOT auto-generate columns if possible, so you can control which ones are readonly and which controltemplate goes where... just use the Binding property of the columns so you dont need to autogenerate them.

提交回复
热议问题