Make some DataGrid columns editable while others are not editable

  • Thread starter Thread starter a
  • Start date Start date
A

a

Is it possible to make some DataGrid's column editable, while some others
not editable? Thanks.
 
you can accomplish this using the DataGrid.TableStyles.ColumnStyles
collection. You can manage each individual column's width.

I believe there's also a way to do this directly in the underlying
datasource, but that method escapes me at the moment.

I believe you can control table
 
Maybe the DataSource is the right solution. For now, I created a new class
DataGridReadOnlyTextBoxColumn inheriting from DataGridTextBoxColumn and
overrode Edit method to just return.

I can't set the width to zero, because I still want to display the columns.

Thanks.
 
actually, yup. sorry about that. i got lost in thinking about something else
while answering this post and ended up providing an incorrect answer
(sorry!). I was thinking about how to set the width of a datagrid column to
0...

tim's answer is the best method that i know of.
 
Oh my, how did that escape me? :) Thanks guys.


jim said:
actually, yup. sorry about that. i got lost in thinking about something else
while answering this post and ended up providing an incorrect answer
(sorry!). I was thinking about how to set the width of a datagrid column to
0...

tim's answer is the best method that i know of.
 
I had a very similar situation. I just used the readonly property and that
worked fine.... but.... the users were very happy when I also figured out
how to display any data in the 'writeable' columns in a different colour (I
used red... readonly data black). Just an idea... I'll try to dig out some
code tomorrow.
 
That's very interesting, and probably something I'll have to do some day
(change background color). Now, I don't believe there is a property for the
background color, right? :)
 
Back
Top