Prev | Current Page 233 | Next

Matthew MacDonald

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

Left="70" Canvas.Top="120" Width="100" Height="50">
(70,120)
nNote The actual values you use for the Canvas.ZIndex property have no meaning. The important detail is
how the ZIndex value of one element compares to the ZIndex value of another. You can set the ZIndex using
any positive or negative integer.
The ZIndex property is particularly useful if you need to change the position of an element
programmatically. Just call Canvas.SetZIndex() and pass in the element you want to
modify and the new ZIndex you want to apply. Unfortunately, there is no BringToFront() or
SendToBack() method??”it??™s up to you to keep track of the highest and lowest ZIndex values
if you want to implement this behavior.
The InkCanvas
WPF also includes an InkCanvas element that??™s similar to the Canvas in some respects (and
wholly different in others). Like the Canvas, the InkCanvas defines four attached properties
that you can apply to child elements for coordinate-based positioning (Top, Left, Bottom, and
Right). However, the underlying plumbing is quite a bit different??”in fact, the InkCanvas
doesn??™t derive from Canvas, or even from the base Panel class. Instead, it derives directly from
FrameworkElement.
The primary purpose of the InkCanvas is to allow stylus input. The stylus is the penlike
input device that??™s used in tablet PCs.


Pages:
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245