WP7 listbox scroll by item - windows-phone-7

I have listbox in WP7 where i need to scroll to certain items according to user choice and i use scrolltoview for that. Problem is that i need listbox to scroll listbox enough so that selected item appears aligned to top edge. Right now scrolled item is positioned at bottom.

Assuming that you have fixed (and known) size items and a fixed (and known) size of listbox, can't you just account for the number of items between the top and bottom of the visible space and adjust your offset accordingly?

Unfortunately Matt solution was unusable in this case because listbox items were too big taking almost whole screen per item. But i was able to solve this problem by getting scrollviewer of listbox and use its scroll method to scroll into listbox SelectedIndex. Item is still not positioned perfectly after scrolling but height difference is minimal and acceptable for me.

Related

Get the Maximum and current value of Scrollbar in Listview

As the title say:
I want to know values of a scrollbar in the ListView such as:
Minimum value I know = 0 :)
Maximum value of a scrollbar
Current value (position of a bar inside of a scrollbar)
Is this possible?
How to make it work for both iOS and Android?
I have tried with ItemAppear to get the position in the ListView but all I can get is the position of an item not the actual scrollbar position and with ItemAppear the problem is if I have big images in the list then I scroll 1 mile but nothing happens until the other item appears.
ListView doesn't fire Scrolled events like ScrollView does.
If you still want to get current value or maximum value of scrollbar, I suggest you can render new Listview, that contains scrolled event. or you can search some third party control, may be have this event.

Detect the scrolling position of list view when little bit position changing(Without changing appearing item) also in xamarin forms

I want to find out the scroll view position of a list view, if we change the scrolling position little bit also. I have browse the net many solutions suggested that using 'ItemAppearing' event in list view but that event is not satisfying my requirement because that event fire only when item will be changed at the time of scrolling but In my list each item height is nearly equal to the my screen height that's for changing the item it takes large position of scrolling. Because of that after scrolling large position only that event will fired but what my requirement is just changing the little position of scrolling also need to detect that one. Please suggest any idea. Thanks in advance.

WP7 Stackpanel/Canvas issue

so I have a question regarding my stackpanel I'm using.
Basically when I keep adding items (expenses/earnings) the into the stackpanel I will eventually be short on navigational space and ultimately the older entries be overwritten.
So at the moment it has a maximum of five entries that can be added and displayed all at one. However If I add another entry/item/expense etc the first entry will be removed/not seen in the stackpanel
So in the picture, as soon as a 6th item is added the 1st item in the list will be removed/not visible
Kind of hard to explain, hope you can help!
More code:
pivotItem XAML
ItemsList control XAML
put the stackpanel in a scrollviewer. This should allow for automatic resizing as more data is added and you can scroll through it as well

How to center selectedItem in listbox in wp7?

I use listbox.ScrollIntoView(item), but as long as this item is in listbox view, it won't scroll.
Actually I want the item to be centered in the listbox's view. Is there anyway to do this?
Unfortunately this is not all that easy, it depends on whether your listbox is virtualized or not, which depends on the panel that it uses to render its contents. For a non-virtualizing listbox, you can set the vertical scroll position by invoking the following method on the ScrollViewer which is part of the listbox template, where offset is in pixels.
ScrollViewer.ScrollToVerticalOffset(offset);
For virtualizing, you can invoke the following method on the VirtualizingStackPanel, where offset is the list location (you can use a double value, i.e. scrolling to 3.5 will scroll to half way between index 3 and 4):
ItemsHostStackPanel.SetVerticalOffset(offset);
For how to use this code in context, look at the jump list control I implemented here:
http://wp7contrib.codeplex.com/SourceControl/changeset/view/72741#1502048

Silverlight 4 Stack panel - animating child when item removed

I want to modify a stack panel, so when an item is removed from it all the items under it slides in animation upwards to fill the missing gap. what is the approach I need to take in order to achieve this ?
Use ListBox instead, and have its ItemsPanel be a StackPanel. Then, modify the style of the items to include an animation in AfterLoaded, BeforeLoaded, and BeforeUnloaded visual states.
http://msdn.microsoft.com/en-us/magazine/ff798276.aspx

Resources