Smart Scroll after load on demand

2 posts, 0 answers
  1. Taehee
    Taehee avatar
    1 posts
    Member since:
    Aug 2010

    Posted 03 Nov 2010 Link to this post

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

        });

      }

    }

     

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 08 Nov 2010 Link to this post

    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
  3. DevCraft banner
Back to Top