I'm using a TreeListView. My goal was to have a toggle for read-only vs. edit mode, so I have a control to toggle the this state by changing the TreeListView CellEditActivation to CellEditActivateMode.None to disable and SingleClickAlways to enable.
When set to None, the columns in the treeview appear disabled, and when switched to SingleClickAlways they render enabled. The rest of this is seemingly not relevant, but I have several different datatypes and editors in place. I use CellEditStarting to 'cancel' editing based on model object. I also use ObjectListView.EditorRegistry.RegisterFirstChance() to inject some custom editors.
Everything seems to work as I expect except for columns with IsEditable and CheckBoxes both set to true (bound to boolean model properties). In this situation, when CellEditActivation is set to CellEditActivateMode.None the user can still click the checkbox and change the state of the model (it also updates the state of the checkbox). Neither CellEditStarting or the handler for RegisterFirstChance is called.
I can set IsEditable to false on these columns with the editing toggle, but this is pretty unclean. Is this a known issue with OLV, or something with the underlying Winforms ListView? Can you think of a cleaner workaround?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using a TreeListView. My goal was to have a toggle for read-only vs. edit mode, so I have a control to toggle the this state by changing the TreeListView CellEditActivation to CellEditActivateMode.None to disable and SingleClickAlways to enable.
When set to None, the columns in the treeview appear disabled, and when switched to SingleClickAlways they render enabled. The rest of this is seemingly not relevant, but I have several different datatypes and editors in place. I use CellEditStarting to 'cancel' editing based on model object. I also use ObjectListView.EditorRegistry.RegisterFirstChance() to inject some custom editors.
Everything seems to work as I expect except for columns with IsEditable and CheckBoxes both set to true (bound to boolean model properties). In this situation, when CellEditActivation is set to CellEditActivateMode.None the user can still click the checkbox and change the state of the model (it also updates the state of the checkbox). Neither CellEditStarting or the handler for RegisterFirstChance is called.
I can set IsEditable to false on these columns with the editing toggle, but this is pretty unclean. Is this a known issue with OLV, or something with the underlying Winforms ListView? Can you think of a cleaner workaround?