September 2012
Intermediate to advanced
464 pages
10h 55m
English
Panels contain elements that are typically added in XAML as a base for the user interface. Sometimes, however, we need to add or remove elements dynamically at run time based on user actions or other criteria. Let's see how this can be done.
Make sure Visual Studio is up and running.
We'll create a simple circle drawing program. Every click adds a circle to a Canvas.
CH03.PaintingCircles.MainWindow.xaml. Replace the default Grid with a Canvas, name it _canvas, and set its Background to White.MouseUp event to the Canvas:<Canvas x:Name="_canvas" Background="White"
MouseUp="OnClickCanvas">
</Canvas>