From the course: Windows Presentation Foundation: 2 Layout
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Scrolling content with the ScrollViewer
From the course: Windows Presentation Foundation: 2 Layout
Scrolling content with the ScrollViewer
- [Instructor] Use the ScrollViewer when you have content that is too large to fit an area on the screen. The user can't see all the content, so you add a ScrollViewer and then the user can scroll to the left or right, or up and down, or both to see the rest of the content. For this example, I'm using two images that are too big to fit and they are in grids and those grids are inside a parent grid. When I click on this picture I can see in the designer that it's too tall to fit. I can see that because of the selection rectangle that's around it and I can see it scrolling off the bottom of the designer. It's the same when I click on this picture here, I can see that it's too wide to fit. I can see that in Visual Studio, this is what the user sees. They see some pictures and they don't know that they're missing part of the view. To fix it you just have to change the parent grid to a ScrollViewer, like this. With that one change, I now get a scrollbar on the right side of the image, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Understand layout and child elements3m 15s
-
Use the LetterBox custom project4m 21s
-
Explore the layout panels3m 12s
-
Use the StackPanel5m 42s
-
Use the WrapPanel5m 1s
-
Use the DockPanel4m 42s
-
Use the UniformGrid3m 24s
-
Explore columnar layout with the grid6m 5s
-
Work with grid column and row sizes6m 49s
-
Add grid rows and columns with the designer4m 22s
-
Size grid rows and columns with the designers6m
-
Position grid child elements with the designer4m 13s
-
Make sizeable grid cells with the GridSplitter7m 57s
-
Absolute positioning with the Canvas3m 28s
-
Scrolling content with the ScrollViewer3m 3s
-
Use a TabControl3m 27s
-
-
-
-