Hi,
is it possible to auto scroll GridView when selecting data with mouse?
When I click on first row and first cell, hold the mouse button and drag with mouse to select more rows, I need that GridView auto scrolls to show me rows, which did not fit in a page.
Because now I cannot select rows which are not visible.
Van Elpho
is it possible to auto scroll GridView when selecting data with mouse?
When I click on first row and first cell, hold the mouse button and drag with mouse to select more rows, I need that GridView auto scrolls to show me rows, which did not fit in a page.
Because now I cannot select rows which are not visible.
Van Elpho
8 Answers, 1 is accepted
0
Emanuel Varga
Top achievements
Rank 1
answered on 01 Dec 2010, 09:08 PM
Hello van,
This behavior is not supported by default, and in my point of view could be very hard to understand for some users, but if you are sure you want this behavior just let me know and i will try to put together a sample project.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
This behavior is not supported by default, and in my point of view could be very hard to understand for some users, but if you are sure you want this behavior just let me know and i will try to put together a sample project.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
van
Top achievements
Rank 1
answered on 01 Dec 2010, 11:09 PM
Hi Emanuel,
sample project would be great. This behavior is for example in Excel, so I thought it's a standard.
Best regards
Van Elpho
sample project would be great. This behavior is for example in Excel, so I thought it's a standard.
Best regards
Van Elpho
0
Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 12:28 AM
Hello Van,
Can you also confirm as it may help Emanuel and anyone else looking at this what version you are using please? I know there are some scrolling issues (not related to this particulaly) in the current 2010 Q3 version that I understand are due to be looked at for the upcoming service pack due in mid December.
thanks
Richard
Can you also confirm as it may help Emanuel and anyone else looking at this what version you are using please? I know there are some scrolling issues (not related to this particulaly) in the current 2010 Q3 version that I understand are due to be looked at for the upcoming service pack due in mid December.
thanks
Richard
0
van
Top achievements
Rank 1
answered on 02 Dec 2010, 10:27 AM
Hello Richard,
I am using version 2010.1.10.308.
Best regards
Van Elpho
I am using version 2010.1.10.308.
Best regards
Van Elpho
0
Accepted
Hello van,
Currently RadGridView does not support this feature. However, it is a nice feature and I added it in our issue tracking system. We will consider implementing it in one of our upcoming releases.
Should you have any further questions, do not hesitate to ask.
Greetings, Jack
the Telerik team
Currently RadGridView does not support this feature. However, it is a nice feature and I added it in our issue tracking system. We will consider implementing it in one of our upcoming releases.
Should you have any further questions, do not hesitate to ask.
Greetings, Jack
the Telerik team
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 03 Dec 2010, 04:07 PM
Hello guys,
Sorry for the delay, but I've managed to put a very basic sample together, please take a look at the following example:
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
Sorry for the delay, but I've managed to put a very basic sample together, please take a look at the following example:
namespace
SelectMultipleLinesByClicking
{
using
System;
using
System.ComponentModel;
using
System.Drawing;
using
System.Linq;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
public
partial
class
Form1 : Form
{
private
RadGridView radGridView1;
public
Form1()
{
InitializeComponent();
this
.Controls.Add(radGridView1 =
new
RadGridView());
radGridView1.Dock = DockStyle.Fill;
this
.radGridView1.MasterTemplate.AllowAddNewRow =
false
;
this
.radGridView1.EnableFiltering =
true
;
radGridView1.GridBehavior =
new
CustomGridBehavior();
radGridView1.MultiSelect =
true
;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
protected
override
void
OnLoad(EventArgs e)
{
radGridView1.DataSource =
new
TestsCollection();
}
}
public
class
Test
{
public
int
Id {
get
;
set
; }
public
string
name {
get
;
set
; }
public
Test(
int
id,
string
name)
{
this
.Id = id;
this
.name = name;
}
}
public
class
TestsCollection : BindingList<Test>
{
public
TestsCollection()
{
for
(
int
i = 0; i < 1000; i++)
{
this
.Add(
new
Test(i,
"Name"
+ i));
}
}
}
public
class
CustomGridBehavior : BaseGridBehavior
{
public
bool
IsMouseDown {
get
;
set
; }
private
Timer scrollTimer;
public
CustomGridBehavior()
{
scrollTimer =
new
Timer();
scrollTimer.Interval = 200;
scrollTimer.Tick +=
new
EventHandler(scrollTimer_Tick);
}
void
scrollTimer_Tick(
object
sender, EventArgs e)
{
if
(!(scrollTimer.Tag
is
Point))
{
return
;
}
var location = (Point)scrollTimer.Tag;
var cell =
this
.GridControl.RootElement.ElementTree.GetElementAtPoint(location)
as
GridCellElement;
if
(cell !=
null
)
{
var row = cell.RowInfo
as
GridViewRowInfo;
if
(row !=
null
)
{
if
(
this
.GridControl.TableElement.VisualRows.Where(r=>
this
.GridControl.TableElement.VisualRows.Count -
this
.GridControl.TableElement.VisualRows.IndexOf(r) < 3).Any(r=>
r.RowInfo == row))
{
if
(
this
.GridControl.Rows.Count > row.Index + 1)
{
row.IsSelected =
true
;
this
.GridControl.Rows[row.Index + 1].EnsureVisible();
}
}
}
}
}
public
override
bool
OnMouseUp(MouseEventArgs e)
{
IsMouseDown =
false
;
scrollTimer.Enabled =
false
;
return
base
.OnMouseUp(e);
}
public
override
bool
OnMouseDown(MouseEventArgs e)
{
IsMouseDown =
true
;
return
base
.OnMouseDown(e);
}
public
override
bool
OnMouseMove(MouseEventArgs e)
{
if
(IsMouseDown)
{
scrollTimer.Tag = e.Location;
if
(!scrollTimer.Enabled)
scrollTimer.Enabled =
true
;
}
return
base
.OnMouseMove(e);
}
}
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Hi Emanuel, thank you for this solution. We will consider your code when implementing the feature.
Best wishes,
Jack
the Telerik team
Best wishes,
Jack
the Telerik team
0
van
Top achievements
Rank 1
answered on 11 Dec 2010, 08:15 PM
Thank you Emanuel, that's exactly what I've been looking for.