DataGridTextBoxColumn.WidthChange to trigger method
-
I would like to write the width of a cell in a datagrid to the registry when a user changes the size. I'm using a TableStyle to customize this DataGrid. ( just from the code, not the gui ) I have a method named: SaveSettings() which writes the current width of the datagrid cells to the registry. The problem is that I can not figure out how to trigger this method. Here is how I setup my dg column .. can someone help me with a way to trigger a method on change of the width of this column?
DataGridTextBoxColumn DetailID = new DataGridTextBoxColumn(); DetailID.HeaderText = "Detail ID"; DetailID.MappingName = "DetailID"; DetailID.Width = 50; DetailID.WidthChanged // how do i use this ?
Thanks in advance. -
I would like to write the width of a cell in a datagrid to the registry when a user changes the size. I'm using a TableStyle to customize this DataGrid. ( just from the code, not the gui ) I have a method named: SaveSettings() which writes the current width of the datagrid cells to the registry. The problem is that I can not figure out how to trigger this method. Here is how I setup my dg column .. can someone help me with a way to trigger a method on change of the width of this column?
DataGridTextBoxColumn DetailID = new DataGridTextBoxColumn(); DetailID.HeaderText = "Detail ID"; DetailID.MappingName = "DetailID"; DetailID.Width = 50; DetailID.WidthChanged // how do i use this ?
Thanks in advance.DetailID.WidthChanged += new EventHandler(MyIDColumnWidthChanged);
Then write the method body forMyIDColumnWidthChanged
. See Consuming Events[^] for further help on hooking up the event. Roger Stewart "I Owe, I Owe, it's off to work I go..." -
DetailID.WidthChanged += new EventHandler(MyIDColumnWidthChanged);
Then write the method body forMyIDColumnWidthChanged
. See Consuming Events[^] for further help on hooking up the event. Roger Stewart "I Owe, I Owe, it's off to work I go..."Thank You very much. It works great! Would not have been able to do it without the consuming events link also =)