Prev | Current Page 223 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

It??™s also possible to
use the arrow keys to resize a GridSplitter once it receives focus.
The ShowsPreview isn??™t the only GridSplitter property that you can set. You can also adjust
the DragIncrement property if you want to force the splitter to move in coarser ???chunks??? (such
as 10 units at a time). If you want to control the maximum and minimum allowed sizes of the
columns, you simply make sure the appropriate properties are set in the ColumnDefinitions
section, as shown in the previous example.
CHAPTER 4 n LAYOUT 101
nTip You can change the fill that??™s used for the GridSplitter so that it isn??™t just a shaded gray rectangle. The
trick is to use the Background property, which accepts simple colors and more complex brushes. You??™ll learn
more in Chapter 7.
A Grid usually contains no more than a single GridSplitter. However, you can nest one
Grid inside another, and if you do, each Grid may have its own GridSplitter. This allows you to
create a window that??™s split into two regions (for example, a left and right pane), and then further
subdivide one of these regions (say, the pane on the right) into more sections (such as a
resizable top and bottom portion). Figure 4-14 shows an example.
Figure 4-14. Resizing a window with two splits
Creating this window is fairly straightforward, although it??™s a chore to keep track of the
three Grid containers that are involved: the overall Grid, the nested Grid on the left, and the
nested Grid on the right.


Pages:
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235