// save visual position of a list public void saveMediaItemListPosition(ListBox _list, MediaList _mediaList) { if (_list == null || _mediaList == null) return; ScrollViewer sv = (ScrollViewer)this.getScrollViewer(_list); if (sv != null) _mediaList.visualPosition = sv.VerticalOffset; }
// this method fills a given listView with Raumfeld mediaList Data and scrolls the view to a specific position if given on the mediaList public void setMediaItemListViewData(ListBox _listView, MediaList _mediaList) { try { lock (_listView) { _listView.ItemsSource = _mediaList.list; _listView.Items.Refresh(); ScrollViewer sv = (ScrollViewer)this.getScrollViewer(_listView); if (sv != null && _mediaList != null && _mediaList.visualPosition != null) sv.ScrollToVerticalOffset((double)_mediaList.visualPosition); } } catch (Exception ex) { throw (ex); } this.loadMediaItemListViewImages(_listView); }