Accessing a static property from XAML
XAML provides an easy way to set values of properties—type converters and the extended property syntax allow for flexible setting of values. However, some things cannot be expressed as a simple value, such as setting a property to the value of some static property.
Make sure Visual Studio is up and running.
How to do it...
We'll create an application that uses a static property from within XAML:
- Create a new WPF Application named
MainWindow.xaml. Replace the
Gridelement with a
- Add some shapes as shown in the following code block:
<StackPanel> <Ellipse Stroke="Black" Height="50" /> <Rectangle Stroke="Black" Height="50" /> </StackPanel>
- Suppose we want to fill the ...