selected item in my listbox must always be first item in the list. I was hoping to achieve this by putting ListBox into ScrollViewer and on ListBox.SelectionChanged send several ScrollViewer.LineDown(). In some cases this works, but if i select last item in the list, LineDown() does nothing because there is nowhere to scroll. Is there any way to override this, or perhaps i should use different approach?
Your scenario is a little bit vague so depending on your reguirements this may or may not be helpful. You might try to move the selected Item to the top of the ListBox and then scroll the box to the top. If the ItemsCollection is databound you would have to manipulate the source collection of course... Not sure if moving the items around is acceptable in your scenario though...
- Proposed as answer by Richard Shedleur Tuesday, February 05, 2013 3:17 PM
This would work, but i kept this idea as a backup scenario. I'll try to clear up what i'm trying to do. I have a ListBox what holds some items. When item is selected it expands into full blown control that has Next/Prev buttons. Next/Prev buttons move list selection. Now if i press Next, ListBox selects next item and it becomes 'expanded' but the whole control is a bit lower so i have to move my mouse down to reach Next button again. So instead of trying to catch control each time i press next i would rather have it stay in one place. My idea was to user Scrolling somehow and make the selected item stay in one place.