6 Answers, 1 is accepted
0
Patryk
Top achievements
Rank 1
answered on 10 Sep 2013, 08:51 AM
I found a solution:
radGridView1.GridBehavior =
new
CustomGridBehavior();
private
class
CustomGridBehavior : BaseGridBehavior
{
public
override
bool
OnMouseDown(MouseEventArgs e)
{
var cell =
this
.GridControl.ElementTree.GetElementAtPoint(e.Location)
as
GridHeaderCellElement;
if
(cell !=
null
&& e.Button == MouseButtons.Left)
{
return
false
;
}
return
base
.OnMouseDown(e);
}
}
0
Hello Patryk,
I can confirm that this is the recommended way to achieve the desired functionality. Should you have any other questions do not hesitate to contact us.
Regards,
Stefan
Telerik
I can confirm that this is the recommended way to achieve the desired functionality. Should you have any other questions do not hesitate to contact us.
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Patryk
Top achievements
Rank 1
answered on 13 Sep 2013, 07:58 AM
It should be:
My previous version broke grouping, column resizing and column order changing.
private
class
CustomGridBehavior : BaseGridBehavior
{
private
bool
_isSort;
public
override
bool
OnMouseDown(MouseEventArgs e)
{
var cell =
this
.GridControl.ElementTree.GetElementAtPoint(e.Location)
as
GridHeaderCellElement;
if
(cell !=
null
&& e.Button == MouseButtons.Left)
{
_isSort =
true
;
}
return
base
.OnMouseDown(e);
}
public
override
bool
OnMouseMove(MouseEventArgs e)
{
_isSort =
false
;
return
base
.OnMouseMove(e);
}
public
override
bool
OnMouseUp(MouseEventArgs e)
{
var cell =
this
.GridControl.ElementTree.GetElementAtPoint(e.Location)
as
GridHeaderCellElement;
if
(cell !=
null
&& e.Button == MouseButtons.Left && _isSort)
{
return
false
;
}
return
base
.OnMouseUp(e);
}
}
My previous version broke grouping, column resizing and column order changing.
0
Hello Patryk,
Thank you for writing back and for the shared solution.
In order to change the default BaseGridBehavior, the recommended approach is to implement your own one just like you did. Thus you can handle all mouse or key inputs and change their behaviour if it is necessary. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for writing back and for the shared solution.
In order to change the default BaseGridBehavior, the recommended approach is to implement your own one just like you did. Thus you can handle all mouse or key inputs and change their behaviour if it is necessary. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Patryk
Top achievements
Rank 1
answered on 19 Sep 2013, 07:24 AM
There is one broken thing with my approach, check this scenario:
1. left-click on header - nothing
2. left-click on excel-like filtering button on header - starts sorting
How can I get rid of this unexpected behaviour?
1. left-click on header - nothing
2. left-click on excel-like filtering button on header - starts sorting
How can I get rid of this unexpected behaviour?
0
Hello Patryk,
Thank you for contacting Telerik Support.
I have not succeeded to reproduce the second scenario described in your previous post: left-click on excel-like filtering button on header starts sorting - it just opens Filtering popup on my end. Could you please specify what are the exact steps you perform to enable sorting in this scenario? And which version do you use? A sample project will be really appreciated. Thank you in advance.
Regards,
Desislava
Telerik
Thank you for contacting Telerik Support.
I have not succeeded to reproduce the second scenario described in your previous post: left-click on excel-like filtering button on header starts sorting - it just opens Filtering popup on my end. Could you please specify what are the exact steps you perform to enable sorting in this scenario? And which version do you use? A sample project will be really appreciated. Thank you in advance.
Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>