Hi Joemelle,
Thank you for contacting us.
You can implement a custom solution which will fit your needs. I have created a sample class which may get you started:
public
class
MyGridViewComboBoxColumn : GridViewComboBoxColumn
{
private
IList dynamicDataSource;
private
IList actualDataSource;
private
int
dataLoadStep = 100;
private
RadDropDownListEditor comboBoxEditor;
private
RadDropDownListElement editorElement;
private
int
savedScrollPosition;
public
int
DataLoadStep
{
get
{
return
this
.dataLoadStep;
}
set
{
if
(value < 50)
{
throw
new
ArgumentException(
"The DataLoadStep can not be less than 50 so that a scrollbar can be visible after the initial load"
);
}
this
.dataLoadStep = value;
}
}
public
IList ActualDataSource
{
get
{
return
this
.actualDataSource;
}
set
{
this
.actualDataSource = value;
this
.DataSource =
this
.actualDataSource;
}
}
public
IList DynamicDataSource
{
get
{
return
this
.dynamicDataSource;
}
set
{
if
(
this
.actualDataSource ==
null
)
{
throw
new
ArgumentException(
"Add a ActualDataSource first"
);
}
this
.dynamicDataSource = value;
IList dataSource = (IList)
this
.DataSource;
for
(
int
i = dataSource.Count; i <
this
.DataLoadStep; i++)
{
dataSource.Add(
this
.dynamicDataSource[i]);
}
}
}
public
MyGridViewComboBoxColumn(
int
dataLoadStep)
:
this
()
{
this
.DataLoadStep = dataLoadStep;
}
public
MyGridViewComboBoxColumn()
:
base
()
{
}
public
override
void
InitializeEditor(IInputEditor editor)
{
base
.InitializeEditor(editor);
RadDropDownListEditor comboBoxEditor = editor
as
RadDropDownListEditor;
if
(comboBoxEditor !=
null
)
{
this
.comboBoxEditor = comboBoxEditor;
RadDropDownListElement element = (RadDropDownListElement)comboBoxEditor.EditorElement;
if
(element !=
null
)
{
this
.editorElement = element;
element.ListElement.VScrollBar.ValueChanged -= VScrollBar_ValueChanged;
element.ListElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged;
}
}
}
private
void
VScrollBar_ValueChanged(
object
sender, EventArgs e)
{
RadScrollBarElement scroll = (RadScrollBarElement)sender;
if
(scroll.Value + scroll.LargeChange >= scroll.Maximum - 400)
{
this
.savedScrollPosition = scroll.Value;
this
.LoadDataSource();
}
}
private
void
LoadDataSource()
{
IList currentDataSource = (IList)
this
.DataSource;
int
maxCount = currentDataSource.Count +
this
.dataLoadStep;
if
(maxCount <
this
.DynamicDataSource.Count)
{
for
(
int
i = currentDataSource.Count; i < maxCount; i++)
{
object
source =
this
.dynamicDataSource[i];
this
.actualDataSource.Add(source);
}
this
.comboBoxEditor.EndEdit();
this
.InitializeEditor(
this
.comboBoxEditor);
this
.editorElement.ShowPopup();
this
.editorElement.ListElement.VScrollBar.Value =
this
.savedScrollPosition;
}
}
}
You can use it as follows:
My BindingClass has a single Property - "Name" and the bindlingCollection is a List<BindingClass>.
I hope this helps.
Regards,
George
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 >>