ScrollViewer + ScrollBar arrows - xaml

When user clicks on the scroll bar arrow, the content shifts very slow(horizontal offset changes on 16). How can I increase the speed of shifting when I click on arrows?
(SmallChange doesn't work)

Unfortunately, it's quite hard-coded in the scroll viewer.
The only way I know of, is to make a new panel based on the panel that you want to use in the scroll viewer, and implement IScrollInfo for it.
Then, setting this panel as the content of the scroll viewer and setting CanContentScroll to true.
StackPanel implements IScrollInfo but other panels do not.

Related

How to implement facebook like menu (left menu) in windows store app

Basically, I want to be able to create a menu which on clicking on some button will appear from left (or right) and on clicking anywhere on main screen the user would be able to dissmis the menu. For example the facebook app has something similar on all platforms (so on Windows 8 also).
I have found a solution for Windows phone (http://sviluppomobile.blogspot.cz/2013/08/add-lateral-menus-to-windows-phone.html), which is not the way to go for Windows 8. Maybe I could use some hand made animation for aflyover, which would be in default outside of viewport. However, I guess there must be better or ideally already proofed solution.
Also I found two questions here on SO, which asked for same thing I guess, but no answers there ...
How to do: lateral menu like in "Music" app on Windows 8 / 8.1 and
https://stackoverflow.com/questions/22613421/windows-8-1-apps-left-menu
I know, that it is not the best way on windows platform to implement menu (we have top app bar, right), but our customer just wants this.
I would like to ask for some hints or ideally a code for a native implementation for Windows 8.1 using XAML (C# or VB.NET). Thanks to everybody who will give it a thought.
You'd put a StackPanel with Orientation="Horizontal" in a ScrollViewer. Put three panels in the StackPanel - let's make them Grids and call them: left, middle and right. On SizeChanged events of the ScrollViewer - set the Width and Height of the middle grid to the same values as ActualWidth and ActualHeight of the ScrollViewer and perhaps set the left and right grids to be a little bit narrower to leave space to see a little bit of the middle panel when you scroll to the ends. Make the ScrollViewer scroll horizontally by setting Horizontal/VerticalScrollMode and scroll bar visibilities and make the ScrollViewer snap to your grid panels by setting the HorizontalSnapPointsType and HorizontalSnapPointsAlignment properties. Also set IsHorizontalRailEnabled on the horizontal ScrollViewer to true if you have any vertical ScrollViewers in your panels and make their IsVerticalRailEnabled="true" so only one of them scrolls depending on the manipulation direction. Finally - put a transparent overlay panel as a top child of the middle panel handle the tap events on the overlay to scroll the middle panel back into view when it isn't centered and in the handlers of the menu buttons scroll the horizontal ScrollViewer to the start/end.

Controlling the AutoScroll behavior on Panel

I have a set of controls inside of a Panel and set the AutoScroll property of the panel to True so I get the Vertical ScrollBar but when I slide the bar is not smooth and if some of the upper controls inside the panel have the focus the bar return to the top.
I read some about and found a solution on
smooth scroll with autoscroll
Which work Ok but uses a lot of resources, I see it on Windows Task Manager, one of the processors goes about 60%, so I think is something wrong with this.
There's another way to met the same goal?
I tried to put my own VerticalScrollBar unsuccessfully. :(

Is control location relative to visible area of form when form has scroll bar?

I have a VB.NET form that dynamically creates a set of controls. If there are too many controls to view on the form, the form will show a scroll bar. (It is an autoscroll form.)
The user can scroll down and click a button which causes the form to change dramatically. It destroys all controls and draws new ones based on user input.
I've noticed that if the user is scrolled to the bottom of the form and click the button, when I destroy and create new controls they aren't located where I want them. It seems to put them relative to the visible portion of the form rather than the top of the top.
Example:
checkbox1.top = 50
checkbox1.left = 15
If the scrollbar is all the way at the bottom, the checkbox should be placed above the visible part of the form. Instead, it is drawn 50 pixels from the top of what I can see.
Please help. How do I make it place the control at an absolute location, rather than being relative to the current position of the scrollbar?
You have to compensate for the scroll position of the container control.
If a panel, then it would look like this:
checkbox1.Top = Panel1.AutoScrollPosition.Y + 50
Alternatively, you could just use a FlowLayoutPanel control, which would handle the placement of the controls for you.

Force Vertical Scrollbar to be Visible in Panel

I have a Windows Forms VB.NET application, with a panel that contains a few other controls.
I set the panel's AutoScroll property to True, and that seems to appropriately apply the scroll bars when they are needed. The issue is that a user must scroll all the way to the right to access the vertical scroll bar. Is there a way to always show the vertical scrollbar no matter where the user is scrolled horizontally?
EDIT
I guess the main problem I have here is that I have a DataGridView inside of a panel. I want the panel to do the vertical scrolling, and not the DataGridView. Why is it when I turn off vertical scrollbars on the datagridview and have autoscroll on the panel, a vertical scroll bar is never shown?
You could add a VScrollBar on the right side of the panel and set code behind to move the panel scroll up and down.
or
A better option may be to switch your panel to a FlowLayoutPanel which provides quite a bit of control over the scroll handles both vertical and horizontal.
Check out MSDN and see how to use all of the properties of the FLP:

Change the width of a scrollbar

Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.
This is a Windows Forms application? I was able to make a very fat and thick scrollbar by adjusting the "Width" property of my scroll bar control.
Is your scroll bar something you have programmatic access to (i.e. it is a control you added to the form)?
The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all windows on the terminal.