This is a migrated thread and some comments may be shown as answers.

Smart Scroll after load on demand

1 Answer 68 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Taehee
Top achievements
Rank 1
Taehee asked on 03 Nov 2010, 06:06 PM
Hello,

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);

    });

  }

}

 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 08 Nov 2010, 03:58 PM
Hi Taehee,

You can use the ScrollIntoViewAsync method as shown here.

Regards,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeListView
Asked by
Taehee
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or