c# - How can you programatically scroll a WrapGrid to a specific item within its ItemSource in a Windows Store App? -


i have following:

<gridview.itemspanel>     <itemspaneltemplate>         <wrapgrid orientation="vertical"                   maximumrowsorcolumns="10" />     </itemspaneltemplate> </gridview.itemspanel> 

i scroll specific item, can't find out how.

so far have:

int itemindex = ...; var scrollbar = thegridview.getfirstdescendantoftype<scrollviewer>(); scrollbar.scrolltohorizontaloffset((double)itemindex / numberrows); 

... feels oddly hacky, , means have programatically calculate number of rows.

const int individualitemheight = /* nasty hard-coded thing */; numberofrows = (int)((thegridview.actualheight - thegridview.padding.top -                       thegridview.padding.bottom) / individualitemheight); 

... more hacky.

there must better way. appreciated!

to scroll specific view gridview need access object bind grid view item , invoke listviewbase.scrollintoview(object)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -