We have an issue in which a RadComboBox configured with VirtualizingStackPanel
and using an ItemsSource of VirtualQueryableCollectionView, sometimes doesn't load items, especially when scrolling to the end of it.
For example, when the combo-box drop-down is opened and initial items are loaded,
If you scroll straight to the end of the combo-box using the vertical scroll-bar,
the ItemLoading event won't be triggered in the VirtualQueryableCollectionView that uses as the ItemsSource.
The scenario is when loading items async (without RIA).
Telerik documentation declare the RadComboBox suppose to work with VirtualQueryableCollectionView
http://www.telerik.com/help/silverlight/using-data-virtualization.html
So my question is, is it RadComboBox / VirtualQueryableCollectionView issue or
is it incorrectly practicing the data virtualization (as shown in the attached sample)?
Thanks
-Attached is a sample that demonstrate the problem-
--The View--
The view-model
The rest
internal
class
ItemsDataLoader
{
public
void
GetItemsAsync(
int
startIndex,
int
itemCount, Action<ItemsAsyncCallResult> completionCallback,
object
userState)
{
var random =
new
Random();
int
delayMilliseconds = random.Next(10, 1000);
AsyncOperation asyncOp = AsyncOperationManager.CreateOperation(
null
);
//remember the calling thread
Timer timer =
null
;
TimerCallback callback =
delegate
{
OnTimerTriggered(timer, asyncOp, startIndex, itemCount, completionCallback, userState);
};
timer =
new
Timer(callback,
null
, delayMilliseconds, Timeout.Infinite);
}
private
void
OnTimerTriggered(Timer timer, AsyncOperation asyncOp,
int
startIndex,
int
itemCount, Action<ItemsAsyncCallResult> completionCallback,
object
userState)
{
timer.Dispose();
IEnumerable<DataItem> items = LoadItems(startIndex, itemCount);
var result =
new
ItemsAsyncCallResult(items, userState);
SendOrPostCallback callbackOnOriginalThread = arg => completionCallback(result);
asyncOp.PostOperationCompleted(callbackOnOriginalThread,
null
);
}
private
IEnumerable<DataItem> LoadItems(
int
startIndex,
int
itemCount)
{
var items =
new
List<DataItem>();
for
(
int
index = startIndex; index < startIndex + itemCount; index++)
{
var item =
new
DataItem
{
Id = index + 1001,
Score = (index % 101),
Text =
"Item No "
+ (index + 1)
};
items.Add(item);
}
return
items;
}
}