# ScrollView directly goes back to initial position

**URL:** <https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693>\
**Category:** Bug Reports\
**Created:** [October 6, 2015, 4:46pm UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693 "2015-10-06T16:46:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreseku](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@andreseku](https://forums.fusetools.com/u/andreseku)\
**Post date:** [October 6, 2015, 4:46pm UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/1 "2015-10-06T16:46:31Z")

</div>

The ScrollView always goes back to the initial position.

The ScrollView consists of several items, and it should be possible to scroll through all the items. When my finger leaves the Touchscreen, the ScrollView directly goes back to the top, so it’s nearly impossible to see all listitems…

(nearly the same “architecture” of code is working in another app…)

Here’s the .\*ux code of this app:

```auto
  <DockPanel>
      <JavaScript File="parse-1.5.0.min.js" ux:Global="Parse"/>
      <JavaScript File="MainView.js"/>

      <StatusBarBackground Dock="Top" />
      <BottomFrameBackground Dock="Bottom" />
          <StackPanel>
              <Grid RowCount="4" Rows="1*,1*,7*,1*">
                  <Grid ColumnCount="3" ColumnData="4*,2*,4*" Margin="5, 15, 5, 5">
                      <Text Value="Team1" TextAlignment="Left" />
                      <Text Value="Tisch" TextAlignment="Center" />
                      <Text Value="Team2" TextAlignment="Right" />
                  </Grid>
                  <Rectangle Width="1000" Height="1">
                      <SolidColor Color="0.04, 0.05, 0.09, 1" />
                  </Rectangle>
                  <ScrollView Margin="5,5,5,5">
                      <StackPanel>
                          <Each Items="{currentGames}">
                              <Grid ColumnCount="3" ColumnData="4*,2*,4*" Margin="5, 0, 5, 0" Padding="0">
                                  <Text Value="{player1Name}" TextAlignment="Left" />
                                  <Text Value="{tableNumber}" TextAlignment="Center" />
                                  <Text Value="{player3Name}" TextAlignment="Right" />
                              </Grid>
                          </Each>
                      </StackPanel>
                  </ScrollView>
                  <StackPanel>
                      <Button Text="REFRESH" Margin="5, 20, 5, 10" Clicked="{refresh}"/>
                      <Grid ColumnCount="2" ColumnData="Auto, Auto" Margin="5,5,5,20">
                          <Text Value="Follow playerID: " TextAlignment="Left" Alignment="CenterLeft" Margin="5, 0, 0, 0" />
                          <TextInput Alignment="Bottom" Margin="0, 15, 0, 0" />
                          <Text Value="Followed player on: " Alignment="VerticalCenter" Margin="5, 15, 0, 0" />
                          <Text Value="currently no match" Alignment="VerticalCenter" Margin="5, 15, 5, 0" />
                      </Grid>
                  </StackPanel>
              </Grid>
          </StackPanel>
  </DockPanel>

```

currentGames is my list of items - from Parse.

---

<div class="post-metadata">

**Author:** ![andreseku](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@andreseku](https://forums.fusetools.com/u/andreseku)\
**Post date:** [October 6, 2015, 6:23pm UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/2 "2015-10-06T18:23:52Z")

</div>

-

---

<div class="post-metadata">

**Author:** ![edA-qa\_mort-ora-y](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/eda-qa_mort-ora-y/32/124_2.png) [@edA-qa\_mort-ora-y](https://forums.fusetools.com/u/edA-qa_mort-ora-y)\
**Post date:** [October 8, 2015, 8:50am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/3 "2015-10-08T08:50:10Z")

</div>

What you’ve inadvertently done is create a layout where the ScrollView actually has enough space to display all of its content, though nonetheless be clipped on the display itself. It snaps back to the start when you scroll since it doesn’t believe scrolling is actually needed.

To fix this we need to reduce the layers in your layout.

First off, remove the `StackPanel` that encloses the `<Grid RowCount="4" Rows="1_,1_,7_,1_">`. There’s no reason to have a `StackPanel` with just one child. Doing just this will get it working, but we might want to do a bit more.

Now it depends on how you want your layout to work what you do now. I have a feeling you don’t actually want a `Grid` here, but instead can just dock things in the dockpanel. You can try removing the `<Grid RowCount="4" Rows="1_,1_,7_,1_">` and instead mark the first two children as `Dock="Top"` and the last child `StackPanel` as `Dock="Bottom"`. This leaves the middle StackPanel with the player list to fill the remaining space. Once it fills this space then it scrolls as you’d expect.

I modified your example to have this structure:

```auto
    <DockPanel>
        <StatusBarBackground Dock="Top" />
        <BottomFrameBackground Dock="Bottom" />
        <Grid ColumnCount="3" ColumnData="4,2,4" Margin="5, 15, 5, 5" Dock="Top">...</Grid>
        <Rectangle Width="1000" Height="1" Dock="Top">...</Rectangle>
        <ScrollView Margin="5,5,5,5">...</ScrollView>
        <StackPanel Dock="Bottom">...</StackPanel>
    </DockPanel>

```

\_

You could also simplify this and just use the `ClientPanel`:

\_

_`<ClientPanel> <Grid ColumnCount="3" ColumnData="4`_`,2_,4_" Margin="5, 15, 5, 5" Dock="Top">...</Grid> <Rectangle Width="1000" Height="1" Dock="Top">...</Rectangle> <ScrollView Margin="5,5,5,5">...</ScrollView> <StackPanel Dock="Bottom">...</StackPanel> </ClientPanel>`

---

<div class="post-metadata">

**Author:** ![1637206422](https://avatars.discourse-cdn.com/v4/letter/1/e47774/32.png) [@1637206422](https://forums.fusetools.com/u/1637206422)\
**Post date:** [December 17, 2015, 11:38am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/4 "2015-12-17T11:38:31Z")

</div>

on your message, do little thing about my quesition (i don’t know how to create a blog here …)

why data item number \> 30 more or less,the scrollview may has this state??? ![file](https://s3.us-east-2.amazonaws.com/fuse-legacy-forum-assets/qbteDkWkccmO-legacy-files-NBMvsqh3aL43VmUo-rV2Q1u6RkuDQTeS-xU9SB5Os.png)

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [December 17, 2015, 1:07pm UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/5 "2015-12-17T13:07:31Z")

</div>

Hello [1637206422@qq.com](mailto:1637206422@qq.com) - I am sorry but I am unable to understand your question. Can you please explain in more detail?

---

<div class="post-metadata">

**Author:** ![1637206422](https://avatars.discourse-cdn.com/v4/letter/1/e47774/32.png) [@1637206422](https://forums.fusetools.com/u/1637206422)\
**Post date:** [December 18, 2015, 3:20am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/6 "2015-12-18T03:20:06Z")

</div>

There will be a once in a while a scrollview item just like that where click but no response。Is it too much data cause？

---

<div class="post-metadata">

**Author:** ![1637206422](https://avatars.discourse-cdn.com/v4/letter/1/e47774/32.png) [@1637206422](https://forums.fusetools.com/u/1637206422)\
**Post date:** [December 18, 2015, 3:24am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/7 "2015-12-18T03:24:02Z")

</div>

But meanwhile other elements can be normal operated.so I am curious about this.

---

<div class="post-metadata">

**Author:** ![justinksr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/justinksr/32/158_2.png) [@justinksr](https://forums.fusetools.com/u/justinksr)\
**Post date:** [December 18, 2015, 3:38am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/8 "2015-12-18T03:38:39Z")

</div>

Hi I’m having the same problem… My `ScrollView` keeps bouncing back to the top, not allowing me to see my “cancel” and “submit” buttons at the bottom…

```auto
<StackPanel>
    <Image File="logo.png" Alignment="TopCenter" StretchDirection="DownOnly" Margin="0,10,0,0" />
    <ScrollView>
        <StackPanel>
            <Grid RowCount="8" Columns="1,3" Margin="0,20,0,20" Alignment="Top">
                <Style>
                    <Text TextAlignment="Right" Alignment="Right" Margin="0,10,0,0" FontSize="14" TextWrapping="Wrap" />
                </Style>
                <Text>First name: </Text>
                <TextInput Value="{firstName}" />
                ...
                ...
                ...
            </Grid>
            <Grid RowCount="1" ColumnCount="2" Alignment="Bottom">
                <Button Text="Cancel" Clicked="{goBack}" />
                <Button Text="Submit" Clicked="{submit}" />
            </Grid>
        </StackPanel>
    </ScrollView>
</StackPanel>

```

---

<div class="post-metadata">

**Author:** ![Bjorn-Olav\_Strand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bjorn-olav_strand/32/583_2.png) [@Bjorn-Olav\_Strand](https://forums.fusetools.com/u/Bjorn-Olav_Strand)\
**Post date:** [December 18, 2015, 7:12am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/9 "2015-12-18T07:12:56Z")

</div>

@justinksr: Here you have the same issue as what mortoray said. The outer `StackPanel` will give the `ScrollView` enough room to show all of it’s contents. Try replacing the `StackPanel` with a `DockPanel`.

---

<div class="post-metadata">

**Author:** ![justinksr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/justinksr/32/158_2.png) [@justinksr](https://forums.fusetools.com/u/justinksr)\
**Post date:** [December 18, 2015, 7:44am UTC](https://forums.fusetools.com/t/scrollview-directly-goes-back-to-initial-position/2693/10 "2015-12-18T07:44:41Z")

</div>

@bolav That worked! Thanks bolav!
