Scrolling is not persisting the new position inside a StackLayout

5 posts, 0 answers
  1. FS
    FS avatar
    17 posts
    Member since:
    Mar 2012

    Posted 08 Dec 2016 Link to this post

    Hi Support:

    I have a RadListView inside the ContentPage and the scrolling was behaving fine.  But then I added an Activity Indicator that should be displayed above the listview to the page like this:

     

    <StackLayout>

         <ActivityIndicator IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}"/>

        <telerikDataControls:RadListView x:Name="lv" ....>

         .........

        </telerikDataControls:RadListView>

    </StackLayout>

    And now the scrolling is not keeping the new scrolled position.  When you release the scroll, the listview returns to the prior position.  This is happening in Android and iPhone.

    Do I need to add a ScrollView or I am missing something here.

    Thanks in advanced.

    David

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    555 posts

    Posted 13 Dec 2016 Link to this post

    Hi,

    Thank you for contacting us.

    You should not put a RadListView inside a StackLayout because the size of the list view is not restricted - all elements will be rendered and the listview will not scroll. The only exception is the Android platform where we restrict the size of the control to the size of the screen due to performance issues.
     
    In your scenario, we recommend using a Grid.
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ActivityIndicator />
        <telerikDataControls:RadListView Grid.Row="1" />
    </Grid>

    I hope this helps.

    Regards,
    Rosy Topchiyska
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  3. FS
    FS avatar
    17 posts
    Member since:
    Mar 2012

    Posted 15 Dec 2016 in reply to Rosy Topchiyska Link to this post

    Hi Rosy:

    WIth your approach the scroll works, but the only issue is that tha Activityindicator is leaving a space when is not visible.  I tried adding Margin="0" to the tha ActivityIndicator without luck.  

    Would be possible to remove this empty space, so the RadLisview is in the edge of the toolbar.  This is hapening both in iOS and Android.

    Thanks

    David

     

  4. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    171 posts

    Posted 15 Dec 2016 Link to this post

    Hi David,

    The Xamarin.Forms ActivityIndicator is a Xamarin.Forms.VisualElement object, so it has an IsVisible property. You can use the IsVisible property to completely hide/show an element.

    For example:

    <ActivityIndicator IsVisible="False"/>


    You can also bind to IsVisible from a view model, which makes it more convenient in MVVM scenarios:

    <ActivityIndicator IsVisible="{Binding IsLoadingData}"/>


    Let us know if you have any further questions.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  5. FS
    FS avatar
    17 posts
    Member since:
    Mar 2012

    Posted 15 Dec 2016 in reply to Lance | Tech Support Engineer, Sr. Link to this post

    Hi Lance:

    I found the problem. The issue was not related with ActivityIndicator.

     

    To fix the issue I added the RowSpacing attribute to 0 for the Grid as follows:

     <Grid RowSpacing="0">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>

    </Grid>

     

     

Back to Top