WPF Hidden ScrollViewer's Bars - wpf

I need a ScrollViewer for WPF application which like on some web pages (like Facebook), scroll bars are hidden even if content is long, but when mouse is over bars become visible. Anyone have idea how to do that?
Tnx.

MVVM focused answer:
I'm sure there is a property which allows you to hide or show the scroll bars.
Bind this property to your ViewModel.
Create a MouseOver event which fires when the mouse moves into a certain part of the screen. To do this, you could overlay an invisible grid over the screen, with the right hand 10% as the target area.
Now when the mouse enters the region, show the scrollbar, and when it exits the region, hide the scrollbar.
Ensure that you set the MinWidth on the invisible region, so that if the window gets narrow, the scrollbar trigger area is still wide enough to be usable.

Related

How to scroll on Textbox(multiline) in C# WPF, by mouse-dragging, not by mouse-wheel?

My TextBox is read-only. and contents is increased more...
Vertical scroll bar of textbox is showed(auto), then user can scroll it by mouse-wheel. it's ok now.
But if i'm going to scroll by mouse-drag on scroll-bar's seek, it's impossible and instead of it, form is moved.
(i used metro-form using mahapp.dll)
How i can scroll the textbox contents by mouse-dragging the seek of textbox scroll-bar?

Animation for SizeToContent resizing

In WPF window, I have specified SizeToContent="WidthAndHeight".
I have a number of panels stacked up, of which I change the visibility (to Visible or Collapsed) as required. My window resizes itself according to the panel that I have set visible. No issues here.
My problem is with the resizing, that the window resizes with a jerk to the final size.
I want to animate this such that the resizing is smooth. And i want to do this in my XAML file.
Is there any solution for this???
P.S. - I have not set any Width or Height property in the window and I want to restrict myself from doing that.

How to change scrolling behaviour when resizing window in WPF/XAML

Research
Currently when working with WPF/XAML, the default scrolling behaviour for the scroll bar is that the VerticalScrollBarVisibility = Visible and the HorizontalScrollBarVisibility = Auto. This means the vertical scroll bar is always visible while the horizontal scroll bar is only visible is the content extends outside the width of the allocated area. Note that while the scrollbar is Visible, if the content do not extend beyong their allocated space, the scroll is deactivated and do not take any user input.
You may change this by changing the values to Visible, Auto, Hidden, or Disabled:
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility = "Auto">
...
</ScrollViewer>
Problem
The problem is if you resize the window of the application and make it smaller, the scroll bars do not react as it should. It seems to just get cut off at the edges as I make the window smaller and smaller. The horizontal scrollbar is never activated. I then made the horizontal scrollbar visible just to see what happens. But it never changes to its active form when I make the windows smaller.
Can I assume that the scrollbar only activates when the content of the allocated space becomes to large for the space and not when the space is reduced when resizing the application window? If so does anyone know a way around this?
Edit
So I was working with my code and I realize that the scroll bar for the main window works as it should when the window is resized but that is not what I want. My main application window consists of three dock panels. Each of these panels needs to have its own scrollbars. It seems that when i resize the main window, the main window's scrollbars activate as appropriate but not the individual section's scrollbars. What I want to do is disable the main windows scroll bar altogether and have only the individual section's scrollbar work.

Silverlight datagrid scrollbar size is wrong

I've got a Silverlight user control that contains a datagrid. The datagrid is bound to an ObservableCollection. The user control is displayed in a popup window that I show in response to some event in another control
There are about 80 objects in the collection, and I've set a fixed height of 400 on the datagrid, so only about 20 items can be shown at one time, and the vertical scrollbar should be shown, with a thumb size occupying about 1/4th of the control height.
However, what's actually happening is that the scrollbar occupies almost the whole control height; maybe 95% of it. The datagrid displays the first 20 items. When I click on the scrollbar down arrow, the scrollbar moves down a little to occupy the bottom 95% of the scroll area, and the datagrid displays the last 20 items.
It gets weirder. If I move over the items in the grid and scroll down using the mouse wheel, then the items scroll correctly and I can view the whole list, although the scrollbar remains the same size.
And then, if I close the popup and reopen it, the scrollbar now appears with the correct height and it works correctly.
Finally, if I just show the control directly on the page, and not in a popup, it works fine.
What's going on here?! Has anyone else run into this problem? Help!
Update: The problem seems to be the way that I'm showing the popup. For various reasons, I had to implement the popup display in a somewhat tricky way, and it's this that's causing the trouble.
I recoded this, removing some crufty stuff, and the problem went away; see my update. This isn't really a solution as such, but I wanted to close out the question for the record.

Showing Tooltip of WPF control under the decrative touches

I have a window with a number of controls upon it, each control with a Tooltip associated. In an effort to jazz up the window a little, I have overlayed some semi-transparent ellipses which gives the whole window a glossy finish, however, in some cases the positioning of these ellipses are preventing the hit-test getting down to my controls.
How can I have the ellipses visible, but transparent from a hit-test point-of-view?
IsHitTestVisible = false

Resources