XAML - Enable scrollviewer in tab item - wpf

I added a scroll bar in a tab item, but the scroll bar is not enabled.... I can't figure out what I have done wrong... Can someone point me in the right direction? CanContentScroll is set to true....

without code to see what you are attempting it's hard to know where you are going wrong...
However, should look something like:
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
<!-- content here -->
</ScrollViewer>
the scroll bars should become visible automatically, if the content increases beyond the size of the control the scrollviewer is placed within.

Related

Adding a vertical scroll bar to a wpf Grid while keeping the header line fixed

I am trying to add a vertical scrollbar to a in WPF. I tried adding the grid into a component which works but then the whole grid scrolls and the header row scrolls as well. I tried without the but then didn't find a VerticalScroll property for the control.
Any help would be very appreciated,
Thanks
Pat
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
//Put the content that you want scrollable here
<Grid>
</Grid>
</ScrollViewer>
Not enough information really maybe post your code?

Dynamic scrolling in a WPF application with ItemsControl object

In my xaml, I have some object made by me. I put them in row and, if the window is too little for all, I go in a new line.
The problem is when the window is so little that, also in a new line, the elements can't be all shown. The solution is simple: scroll bar!! But, if I set the Vertical/HorizontalScrollBarVisibility to auto, it doesn't go to a newline anymore.
This is my xaml:
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled" >
<ItemsControl Name="ItemGroups" ItemsSource="{Binding NotifyItemUI}" />
</ScrollViewer>
and this is a screenshot what I need as my goal:
For example, if I resize my area vertically, and I have 3 rows of objects, in this way I can't see the third row if the window becames too little. In this case, I'd like to see a vertical scrollbar to scroll it.
Same thing horizontally: if I have too many elements for one single row, I have to scroll it horizontally.
What you describe looks like a WrapPanel, but the way you write about it suggests it is a custom control, so we cannot see what your ItemsControl is doing for layout.
However, ScrollViewer can have tricky interaction with a Panel. If the Panel measures to infinity, it will always consider itself big enough, and never tell the ScrollViewer it is out of room. The result is that the ScrollViewerdoes no know the scrollbar is needed. If this is your problem, then setting the Width and Height properties, or maxima as #Sheridan said, ought to fix it.

How can i make a control sticky?

How can i make a control to be sticky? I have a scrollviewer and inside that a grid. Inside grid i have a button. The button is set to horizontal alignment - center and vertical alignment - bottom. Now, when the size of the grid increases the button is no more visible on the screen. I have to scroll to really see the button. Can i make the button to be sticky so that it is always there at the bottom of the screen?
Thanks in advance :)
Anything you put inside the scollviewer will be part of the scrollable content. You can either remove that control and put it outside the scrollviewer, or put inside a floating popup control.
Remove the button from inside the ScrollViewer:
<Grid>
<ScrollViewer>
//Content
</ScrollViewer>
<Button HorizontalAlignment="Center" VerticalAlignment="Bottom" />
</Grid>

WPF window scrolling with top menu

I'm running into a dilemma. When I make the ScrollViewer the main content object of my window, scrolling behaves exactly like I want it to. You resize to make it smaller than the content and the window and scroll bars appear. The problem comes in when I want the to menu to be static and the rest of content to be scrollable. I want the scroll bars to behave the same way as a browser window does, meaning when you resize it, the scroll bars appear based on the size of the content. When you expand the window, the content takes up the entire real estate of the window. Is that possible in WPF?
Help would be GREATLY appreciated.
Make a DockPanel the main content object of your window. Insert your top menu as the first child (with DockPanel.Dock="Top") and the ScrollViewer (containing the rest of the window's content) as the second child. In a DockPanel, the last child takes up all the remaining space, which should be what you want.
<Window ...>
<DockPanel>
<MyMenu DockPanel.Dock="Top" ... />
<ScrollViewer>
....
</ScrollViewer>
</DockPanel>
</Window>

WPF - ScrollView Confusion

I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control.
Here are my Frustrations:
Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it)
Bad Borders I have a ListBox in my ScrollViewer. When I start the bottom of the list has no border and when I scroll down, the top border (line) of the list box disappears. I can kind of understand this, but attempts to set BorderThickness or BorderBrush for the ScrollViewer result in no change (I wanted to use the ScrollViewer's border to keep a constatant box around the list contents, like most list boxes out in cyber world).
Bad Handling of Short Lists When the items in the list don't reach the bottom the ScrollViewer keeps the scroll bar there and just dithers it out. Why not free up some space and remove it?
Some of these may seem petty (and they are). But users expect a certain look and feel from their apps and WPF is making it hard to get this out of the box.
If you know a way to fix any of these I would love a response. If there is a better way to deal with scrolling than using the ScrollViewer that would aslo be welcome.
Maybe you see some scroll bar from inside the list rather than the scroll bar from the ScrollViewer? Try setting <ScrollViewer ... HorizontalScrollBarVisibility="Auto"> (default is Hidden, which means that no horizontal scroll bar is shown ever; also try "Visible" for the sake of debugging)
Is putting a <Border> around the ScrollViewer an option?
VerticalScrollBarVisibility has a default value of Visible. If you want the scroll bar to disappear when it is not necessary, try <ScrollViewer ... VerticalScrollBarVisibility="Auto">.

Resources