I am using TreeListView to display hierarchical information. Each node has it's SubGroups. When a user click a node, it will load the SubGroup information from the WCF service and add the items in SubGroups Observable collection. After the collectionchanged notification, TreeListView is always scroll up to top and a user have to scroll back the working position.
Is there any way to maintain the scroll position?
<telerik:RadTreeListView Name="radTreeListView1"
ItemsSource="{Binding Attributions}"
IsFilteringAllowed="False"
CanUserSortColumns="False"
CanUserReorderColumns="False"
SelectionUnit="FullRow"
FrozenColumnCount="1"
SelectedItem="{Binding SelectedItemInTree, Mode=TwoWay}"
RowIsExpandedChanging="radTreeListView1_RowIsExpandedChanging"
RowLoaded="radTreeListView1_RowLoaded" >
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding SubGroups}" />
</telerik:RadTreeListView.ChildTableDefinitions>
private void radTreeListView1_RowIsExpandedChanging(object sender, RowCancelEventArgs e)
{
Debug.WriteLine("RowIsExpandedChanging");
ViewModel.LoadChildrenAttribution(e.Row.DataContext
as AttributionDataViewModel, () => {});
}
public void LoadChildrenAttribution(AttributionDataViewModel current, Action onComplete)
{
if (current.IsSubGroupLoaded)
{
if (onComplete != null) onComplete();
return;
}
// build filter context
PicasoReportProxy.Instance.ListGroupedAttribution(this.CurrentEntity, context, rst =>
{
RaiseOperationPerformed(
perationNames.ShowHideBusyIndicator, false);
if (rst.WasSuccessful) {
current.LoadSubGroup(rst.Result);
SelectedItemInTree = current;
}
else {
MessageBox.Show(rst.Exception.Message);
}
RunOnUI(onComplete);
});
}
}