By dragging the
splitter bar, the user can change the relative widths of both columns.
CHAPTER 4 n LAYOUT 99
Figure 4-13.Moving a splitter bar
Most programmers find that the GridSplitter isn??™t the most intuitive part of WPF. Understanding
how to use it to get the effect you want takes a little experimentation. Here are a few
guidelines:
??? The GridSplitter must be placed in a Grid cell. You can place the GridSplitter in a cell
with existing content, in which case you need to adjust the margin settings so it doesn??™t
overlap. A better approach is to reserve a dedicated column or row for the GridSplitter,
with a Height or Width value of Auto.
??? The GridSplitter always resizes entire rows or columns (not single cells). To make the
appearance of the GridSplitter consistent with this behavior, you should stretch the
GridSplitter across an entire row or column, rather than limit it to a single cell. To
accomplish this, you use the RowSpan or ColumnSpan properties you considered
earlier. For example, the GridSplitter in Figure 4-13 has a RowSpan of 2. As a result, it
stretches over the entire column. If you didn??™t add this setting, it would only appear in
the top row (where it??™s placed), even though dragging the splitter bar would resize the
entire column.
??? Initially, the GridSplitter is invisibly small.
Pages:
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232