ISupportInitialize and XAML
ISupportInitialize and XAML
Tuesday, 13 April 2010
Article Index
ISupportInitialize and XAML
XAML Trees
Using XAML


Using XAML

Now that we have a parameter-less constructor we can try the Shape class out with XAML.


The only thing we have to do is make sure that we include the namespace of the current project in the XAML file. Assuming that the project is called "trees" the Window tag has to be updated to read:

<Window x:Class="trees.Window1"
"Title="Window1" Height="300"

Following this we can add a Tree object using something like:

<m:Tree L="50" s="0.8" t="90" dt="20" 
d="8" X="150" Y="200" Stroke="Red"
Height="220" Width="289"></m:Tree>

If you try this you will see a tree in the Designer and at run time.



A tree in the Designer

As for integrating the Tree class with XAML everything works as well as can be expected. If you compare the behavior with another Shape class-derived graphic such as Line you will see that it works just as well. In the Designer however there are some differences. In particular the five essential properties are listed in the Property Window and you can update them by entering new values but the Tree doesn't update unless you refresh the Designer.

There are a number of other facilities that don't appear to work properly in the Designer and to find out how to make these work we need to look more closely at the way the properties are defined - the subject of a future article. Follow us on Twitter or register on the site to find out when this article is published.



WriteableBitmap gives you a bitmap object that you can modify dynamically - but exactly how to do this isn't always obvious.

Simple WPF data binding

Find out how WPF data binding really works. It's not the binding object that matters - it's the binding expression.

Custom Shape

Creating a custom Shape isn't difficult but it does have some hidden gotchas. We take a look at how best to do the job.

BitmapImage and local files

When and how to use the BitmapImage class

Routed Events

Routed events were new in .NET 3.5 but there is still plenty to discover about using them. We look at bubbling and tunneling and how to create your own routed even and how WPF changes the underlying m [ ... ]

Other Articles






Last Updated ( Monday, 12 April 2010 )

RSS feed of all content
I Programmer - full contents
Copyright © 2015 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.