Hello, I've got a problem with the grid position
In some specific case, the rows position in the RadGridView are too high.
So when the scroll bar is at the top, you are missing some rows
And when you are at the bottom, you have empty space.
So this happen when I call BeginUpdate(); EndUpdate(); while I'm scrolling.
And only scrolling with the left click (no wheel)
Use the sample code and left clic on the scrollbar, go all the way down, and Voila.
Everything go back to normal if you use the wheel all the way to the Top. But it's not acceptable for our user
In some specific case, the rows position in the RadGridView are too high.
So when the scroll bar is at the top, you are missing some rows
And when you are at the bottom, you have empty space.
So this happen when I call BeginUpdate(); EndUpdate(); while I'm scrolling.
And only scrolling with the left click (no wheel)
Use the sample code and left clic on the scrollbar, go all the way down, and Voila.
Everything go back to normal if you use the wheel all the way to the Top. But it's not acceptable for our user
const
int
CST_AUTO_EXPAND_START = 15;
//Last %
bool
m_alreadyScroll =
false
;
public
Form1()
{
InitializeComponent();
}
private
void
AddDatas()
{
List<
string
> datas =
new
List<
string
>();
for
(
int
i = 0; i < 50; i++)
{
datas.Add(
"string"
+ i.ToString());
}
radGridView1.DataSource = datas;
}
public
void
ExpandPage()
{
m_alreadyScroll =
true
;
radGridView1.BeginUpdate();
//Normally I would update my datasource here threw a background worker
radGridView1.EndUpdate();
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
radGridView1.GridElement.VScrollBar.ValueChanged +=
new
EventHandler(VScrollBar_ValueChanged);
AddDatas();
}
void
VScrollBar_ValueChanged(
object
sender, EventArgs e)
{
if
(m_alreadyScroll)
return
;
Telerik.WinControls.UI.RadScrollBarElement scrollBar = (Telerik.WinControls.UI.RadScrollBarElement)sender;
int
maxValue = scrollBar.Maximum - scrollBar.LargeChange;
//if the scroll bar is in the bottom zone, we search for new data
if
(maxValue - maxValue * CST_AUTO_EXPAND_START / 100 < scrollBar.Value)
ExpandPage();
}