DataGrid Event
-
I have a DataGrid,I need the event that raise,when a user DbClick on a cell or row,But I can't find it,Does anything like this exist in C# or any solution for it? Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Would this work (not tested)? Control.DoubleClick Event [C#] public event EventHandler DoubleClick; Event Data The event handler receives an argument of type EventArgs containing data related to this event. Remarks The ControlStyles.StandardClick style must be set for this event to be raised. Andres Manggini. Buenos Aires - Argentina.
-
Would this work (not tested)? Control.DoubleClick Event [C#] public event EventHandler DoubleClick; Event Data The event handler receives an argument of type EventArgs containing data related to this event. Remarks The ControlStyles.StandardClick style must be set for this event to be raised. Andres Manggini. Buenos Aires - Argentina.
Andres Manggini wrote: Control.DoubleClick Event No,this raised when you double click on fixed column or cells,not regular cells.I think there is solution and thats when you want to edit a cell you have to DbClick on that cell,Do you know what event raised when it goes into edit mode? Andres Manggini wrote: Remarks The ControlStyles.StandardClick style must be set for this event to be raised. Where is that?I couldn't find it. Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
Andres Manggini wrote: Control.DoubleClick Event No,this raised when you double click on fixed column or cells,not regular cells.I think there is solution and thats when you want to edit a cell you have to DbClick on that cell,Do you know what event raised when it goes into edit mode? Andres Manggini wrote: Remarks The ControlStyles.StandardClick style must be set for this event to be raised. Where is that?I couldn't find it. Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975mmm.. I don't know, I'll see if i look into it. this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition). Andres Manggini. Buenos Aires - Argentina.
-
mmm.. I don't know, I'll see if i look into it. this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition). Andres Manggini. Buenos Aires - Argentina.
Andres Manggini wrote: this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition). Sorry,Which documentation you mean? Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
Andres Manggini wrote: this documentation is from MSDN (the one which comes with Visual Studio.NET Enterprise Edition). Sorry,Which documentation you mean? Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Microsoft Visual Studio.NET Documentation. a blue ballon icon, with a question mark inside of it :) Regards, Andres Manggini. Buenos Aires - Argentina.
-
Andres Manggini wrote: Control.DoubleClick Event No,this raised when you double click on fixed column or cells,not regular cells.I think there is solution and thats when you want to edit a cell you have to DbClick on that cell,Do you know what event raised when it goes into edit mode? Andres Manggini wrote: Remarks The ControlStyles.StandardClick style must be set for this event to be raised. Where is that?I couldn't find it. Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975ControlStyles is an enumeration. Each control has one and can be set via the SetStyles() protected method on a control. You pass in the flags you want to set/unset and pass in true or false to tell whether it should set that style. HTH, James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
ControlStyles is an enumeration. Each control has one and can be set via the SetStyles() protected method on a control. You pass in the flags you want to set/unset and pass in true or false to tell whether it should set that style. HTH, James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
Can you give an example please? Thanks:) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Usually you set it in the controls constructor so
public class myDataGrid : DataGrid {
public myDataGrid() {
SetStyle( ControlStyles.StandardClick, true );
}
}Now the Double click events will fire according to the documentation. I can't tell from the documentation if the DoubleClick event will fire for everything now or if it was supposed to indicate the standard event will fire. In anycase you should be able to hook into the DoubleClick event yourself and do some calculating to determine which cell is being clicked on. James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
-
Usually you set it in the controls constructor so
public class myDataGrid : DataGrid {
public myDataGrid() {
SetStyle( ControlStyles.StandardClick, true );
}
}Now the Double click events will fire according to the documentation. I can't tell from the documentation if the DoubleClick event will fire for everything now or if it was supposed to indicate the standard event will fire. In anycase you should be able to hook into the DoubleClick event yourself and do some calculating to determine which cell is being clicked on. James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978
hmmm,So I have to use subclassing,I never do that in C#,Can you tell me how?Is this right: Create new class derived from DataGrid class and handle DoubleClick() event. Then I don't know how to use it in my application. Thanks:) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
hmmm,So I have to use subclassing,I never do that in C#,Can you tell me how?Is this right: Create new class derived from DataGrid class and handle DoubleClick() event. Then I don't know how to use it in my application. Thanks:) Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975Yep thats correct, using a subclassed control is easy; instead of saying System.Windows.Forms.DataGrid, you refer to myDataGrid :) Thats all there is to it. James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978