As we know XAML allows us to define properties of elements using the attribute syntax. It means that,for example, if we want to specify the content/background colour of button control than we can specify it using attributes as shown below:
<Button Content="Attribute Style" Background = "Yellow"/>
However there might be a challenge using this syntax. Consider a scenario where we want to display a rectangle inside the button. In this case it would not be possible to define a rectangle in the content attribute.This will be due to string restrictions of attribute syntax. To overcome this kind of scenarios, XAML provides the Property elements.
The syntax of property element is
<Button>
<Button.Content>
<Rectangle Height="40" Width="40" Fill="Yellow"/>
</Button.Content>
</Button>
Please note how beautifully the rectangle tag is given as child tag for Button.



Property elements in WPF: XAML…
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…
Property elements in WPF: XAML | Tech Samosa…
Thank you for submitting this cool story – Trackback from DotNetShoutout…
[...] it using attributes as shown below: However there might be a challenge using this syntax…. Read more… Categories: .NET XAML Share | Related [...]
Hello,
Thank for this interesting post !
Getting the same behavior from code may interest you too:
http://www.jonathanantoine.com/2011/09/02/convert-in-code-as-in-xaml-how-to-get-thet-xaml-processors-converter/
Regards,