c# - Windows Phone 8 ListBox MVVM scrolling issue -


i writing windows phone application when in 1 of pages displaying listbox items.

my goal scroll listbox automatically down when new item added cant achieve that.

i have read many examples behaviours , triggers binding can't that.

i can't find valid event me can scrollviewer of listbox , go method (this not need that):

var childscount = visualtreehelper.getchildrencount(mylistbox); (int = 0; < childscount; i++) {     if (visualtreehelper.getchild(mylistbox, i) scrollviewer)     {         var sv = visualtreehelper.getchild(ic, i) scrollviewer;         sv.scrolltoverticaloffset(sv.scrollableheight);         break;     } } 

if had write in codebehind there no problem because can raise method when adding new item collection.

problem trying in mvvm.

you need use => listbox.scrollintoview(listbox.items[listbox.items.count - 1]); need set selecteditem last , use selectionchanged use methode when add item.

selecteditem = yourlist[yourlist.lenght - 1] selectionchanged event => listbox.scrollintoview(listbox.items[listbox.items.count - 1]); listbox.clearselection 

i think still work.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -