In my WP7 application, I have pager at the end of the page, so people can navigate prev and next.
When I call 2nd page, Grid loads with new items fine but it stays wherever user left the scroll position.
When I was using ListBox element, I achieved this like this;
ListBox1.UpdateLayout();
ListBox1.ScrollIntoView(ListBoxEntries.Items[0]);
but Grid object does not contain ScrollIntoView function. Is there any workaround for this problem?
You can programmatically change the scroll offset of the ScrollViewer like this:
ScrollViewer scroll = myScrollViewer;
Double verticalOffset = 0; //0 for top, otherwise some calculated value.
scroll.ScrollToVerticalOffset(verticalOffset);
Related
I have a list of contacts.
If the user scrolled down to "Simon" and then resized the window, the scroll position jumps to the top (equal to 0) and i want it to stay at the same position.
I tryied saving the scroll position to the state using onScroll like this:
this.savePosition(params.scrollTop);
and then on window resize event to read the position from the state and scroll to there like this:
this.ref.current.scrollToPosition(this.state.scrollPosition);
but the problem is, the resize event causes onScroll to happen and onResize the state is always getting updated to 0 so my state is worth nothing.
How can i get this to work?
Solved.
Instead of scrolling to position via resize event, i do it via scrollTop like this: scrollTop={this.state.scrollPosition}
I am using TabPanel in my application. Now I have grids and tree panel on every tab.
So whenever I scroll grid or Tree Panel and shift to second tab and then return back to first Tab, Scroll goes to the Top. That's means it doesn't preserve its position.
Also this behavior is only on IE11. In case of Chrome, it works fine. What can be possibly wrong? Can anyone help?
I have this narrow panel which is basically a list of thumbnails, and i need to be able to scroll over them using buttons.
We have a panel (anchor layout), with containers in it, and each container contains the image.
there isn't space for a scrollbar, and anyway we don't want one.
I thought it would be as easy as in the listener for my button calling panel.getEL().scroll('b',20)
but this isn't working because the scrollHeight === ClientHeight so scroll does nothing.
Is there a technique I am missing or should this work?
So you're using a button to scroll through the images? What about having the button's listener remove/hide the containers/images at the front of the panel to allow the others to use the space?
I have a Silverlight application, containing a scrollviewer in a grid layout.
When I move the scroller down and close this grid with the close button, the scroller remains at the bottom whenever I reopen the grid.
Is there a way I can reset the scroller to the top position?
Hello supriya khamesra,
Please Try this.
Please Put your grid inside scroll viewer and then write your bellow code after grid selection change.
grdDetail.ScrollToVerticalOffset(0d);
OR
grdDetail.ScrollToTop();
I have a winform app. On the menu bar, far right, I placed a dropdown box on top of it. When I resize the form the dropdown box obviously stays in the same position (x,y location). How can I get it to move propotionally to the right when the form is resized. It basically stays on the same Y axis.
I can't use a layout control since it's placed on top of the menu.
You can use the Anchor property of the comboBox to do this. Simply set it to Right (probably Top and Right) through the designer.
Or to do it in code:
comboBox1.Anchor = AnchorStyles.Right;