1

So is there a way to stop scrolling up ?

I have listview's scrollview and i tryed saving last position and in listview size changed scroll down - but it first scrolls down and later up ;/ Maybe there is some different event or completly different way ?

Jakub Wisniewski
  • 2,189
  • 4
  • 20
  • 34

1 Answers1

3

You can set the ItemsStackPanel's ItemUpdatingScrollMode.

    <ListView>
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <ItemsStackPanel ItemsUpdatingScrollMode="KeepScrollOffset" />
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
    </ListView>

It only works when the scroll offset is greater than 0, so just scroll using ChangeView() to set it up.

Kai Brummund
  • 3,538
  • 3
  • 23
  • 33
  • That works perfectly , but now i have different question ... ItemSource of ListView are currentEvents (ObservableCollection) - i want the list to be ordered by date property but ListView isn't updated when i call "currentEvents = new ObservableCollection(currentEvents.OrderByDescending(x => x.ed.date).ToList());" but when i comment that line it works (but isnt ordered) – Jakub Wisniewski Jan 14 '15 at 09:08
  • I recommend asking that as a new question and adding the source code there, it's nicer to read. :) Ordering an ObservableCollection is a completely different problem and there are some answers around here. – Kai Brummund Jan 14 '15 at 09:13
  • Any idea how to do this when you're using a VariableSizedWrapGrid in place of an ItemsStackPanel? – Scott Sep 14 '16 at 23:14
  • WrapGrid doesn't have that feature. You have to derive and implement that by yourself, but can't tell if it is possible at all without full access to it's source. – Kai Brummund Sep 15 '16 at 05:22