3 Answers, 1 is accepted
0
Hello Saif,
Thank you for writing.
It is possible to achieve your requirement by subscribing to the RadGridView.MouseWheel event, where you should add a new row if the vertical scroll bar is at the bottom. As to the down arrow key, the RadGridView.PreviewKeyDown event is appropriate for handling this case:
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for writing.
It is possible to achieve your requirement by subscribing to the RadGridView.MouseWheel event, where you should add a new row if the vertical scroll bar is at the bottom. As to the down arrow key, the RadGridView.PreviewKeyDown event is appropriate for handling this case:
public
Form1()
{
InitializeComponent();
this
.radGridView1.ViewCellFormatting += radGridView1_ViewCellFormatting;
this
.radGridView1.MouseWheel += radGridView1_MouseWheel;
this
.radGridView1.PreviewKeyDown += radGridView1_PreviewKeyDown;
for
(
int
i = 0; i < 20; i++)
{
this
.radGridView1.Rows.Add(i, i +
".Data"
, DateTime.Now.AddDays(i));
}
}
private
void
radGridView1_PreviewKeyDown(
object
sender, PreviewKeyDownEventArgs e)
{
if
(e.KeyCode == Keys.Down &&
radGridView1.TableElement.VScrollBar.Value >= radGridView1.TableElement.VScrollBar.Maximum -
radGridView1.TableElement.VScrollBar.LargeChange && radGridView1.CurrentRow !=
null
&&
radGridView1.GridNavigator.IsLastRow(radGridView1.CurrentRow))
{
this
.radGridView1.Rows.AddNew();
}
}
private
void
radGridView1_MouseWheel(
object
sender, MouseEventArgs e)
{
if
(radGridView1.TableElement.VScrollBar.Value >= radGridView1.TableElement.VScrollBar.Maximum -
radGridView1.TableElement.VScrollBar.LargeChange)
{
this
.radGridView1.Rows.AddNew();
}
}
//this is used only to display a row number in the row header
private
void
radGridView1_ViewCellFormatting(
object
sender,
Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if
(e.CellElement
is
GridRowHeaderCellElement)
{
if
(e.Row
is
GridViewDataRowInfo)
{
e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString();
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Saif
Top achievements
Rank 2
answered on 21 Jun 2014, 09:39 AM
Hi Desislava,
This works 100%
Thank you so much.
Which event should i use when user click the arrow on scrollbar?
This works 100%
Thank you so much.
Which event should i use when user click the arrow on scrollbar?
0
Hello Saif,
Thank you for writing back.
You can use the RadGridView.TableElement.VScrollBar.SecondButton.MouseDown event to handle the case when the user clicks over the bottom arrow of the vertical scroll bar.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Desislava
Telerik
Thank you for writing back.
You can use the RadGridView.TableElement.VScrollBar.SecondButton.MouseDown event to handle the case when the user clicks over the bottom arrow of the vertical scroll bar.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Desislava
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.