As per requirement need in C# WPF application , We want to load Data on scrollViewer while moving Horizontal scroll bar.
As we have tried by scrollViewer_ScrollChanged event. But It fired automatically every time while loading of scrollViewer.
In our case we have one grid control inside scrollViewer.
Please help me, looking for positive reply.
Related
I have a ListView in the middle of my page in my WPF application. The problem is when the mouse cursor or my finger is above that ListView then I can't scroll down on that page (the ListView has auto size, no vertical scrolling is needed for it). How can I fix this?
Here's what I tried so far:
setting the Focusable property
setting the ScrollViewer.VerticalScrollBarVisibility to all possible values
changing the size of the ListView from auto to a fixed size
Actually, what happens(and why what you tried didnt work), was that the inner ScrollViewer inside the ListView recieved the MouseScroll events.
It handled them and the set for the RoutedEventArgs Handled="True", meaning the Page's ScrollViewer didnt get the scrolling events.
Bubbling scroll events from a ListView to its parent
You could take the above and implement it as a Behavior on your ListView.
I have some pop up buttons on my scrollview. When hit play ,buttons pop up and if done manually scrolling is also supported. But what I am trying to bring is when my scene loads both my buttons and scrollview should work simultaneously i.e buttons popping up and scrollview getting scrolled as it receives the buttons. Any help would be appreciated. And thanks in advance.
If I get it right u need to scroll automatically each time an item is added to your scrollview.
U could put this in button click event handler:
scrollViewer.LineDown();
scrollViewer is in this case scrollviewer object it's self.
If you're using MVVM pattern, I suggest u to create a behavior class and put it there or via command attached to the button. The solution with command is easier, but dirty.
I'm using a Windows Phone 8.1 project and have a ScrollViewer in my XAML.
Is there an event which will fire when the ScrollViewer start scrolling? Or anyway to trigger code when ScrollViewer start scrolling?
Try ViewChanging and ViewChanged events of ScrollViewer.
Note that these events will be called multiple times during a touch manipulation. You will need to rely on IsIntermediate (in ScrollViewerViewChangedEventArgs) or IsInertial (in ScrollViewerViewChangingEventArgs) to call your code accordingly.
Update
If you want to know when a touch happens immediately I'd give the ScrollViewer's direct child, for example, a StackPanel a transparent background and then subscribe to its PointerEntered event.
In my Windows Phone 8 application I am trying to implement a custom control that behaves like the built-in calendar control which displays the current date above the scrollable content (daily views). Initially I have tried to use the LongListSelector control (which gives me the hierarchical view), but I am not able to determine the scroll position and therefore cannot update the header (the date in the case of the calendar control).
So I switched to using a ScrollViewer control which contains a StackPanel with different controls inside.
Whenever the user scrolls the content I would like to be notified so I can update the UI relative to the content being shown. However, the ScrollViewer doesn't have any explicit scrolling events.
I have tried to use the LayoutUpdated event (which seems to get called frequently enough for my purposes), but when I then update the UI in the event handler another LayoutUpdated event is raised and an infinite loop is created.
How can I update the UI based on the scroll position?
I have no idea, But check this links, this may help.
Get scroll event for ScrollViewer on Windows Phone
http://social.msdn.microsoft.com/Forums/silverlight/en-US/b1cdf697-ed37-4d3a-9f3c-46338bdc92b4/how-to-get-a-scroll-event-from-a-scrollviewer?forum=silverlightbugs
I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible. How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)? This behavior is very annoying when doing a drag from this control.
Thanks.
Added: I am looking for a solution to keep the control itself from scrolling when contents are clicked that the control believes are not fully visible. Often this is by a few pixels and the scroll is not necessary.
The items scroll into view because the default behavior on list item click is to call BringIntoView(). You can add an event handler for the RequestBringIntoView event and catch it before it bubbles up from the ListViewItems to the ScrollViewer. In your handler, check the bounds of the sender against the visible region and if you decide that you don't need to scroll, set the event's Handled flag to true.
Since I'm currently on the road, I cannot try this, but have you tried playing around with CanContentScroll, and/or wrapping the scrollable content into a Panel, as suggested by the ScrollViewer Overview on MSDN?
In the worst case, you might want to replace the ListView's ItemsPanel by a hacked ScrollViewer with a "fuzz" factor, e.g. by capturing the RequestBringIntoView event.
have you tried this approach?
just as an addon, I don't know how much you know about the subject, but here is a good place to read more about it.
added:
I just found that you can prevent the mouse wheel of scrolling as well.