Ugrás a tartalomhoz

.NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

Markup Language Extensions

Markup Language Extensions

Actually, most of the features are described conveniently by the XAML syntax. Howewer, it cannot be satisfactory. (For example: an object you want to set property value that already exists, or would like to seet a value with a dynamic data binding, etc. ) In these cases, markup extensions will be required. Markup language extensions have to be placed between curly {} braces.

{MarkupLangueExtensionName value}

The name of the Markup Language Extension defines for the WPF which extension is it, for example: StaticResource, DynamicResource, etc.


        <SolidColorBrush x:Key="MyBrush" Color="Gold"/>


A unique key can be assigned to the resources created in the ResourceDictionary. More about the resources in the Chapter 0.

<Button Background="{StaticResource MyBrush}"/>

<Ellipse Fill="{StaticResource MyBrush}"/>

If more than one parameter is required to specify the following notation:

{MarkupLanguageExtentionName Parameter1=value1, parameter2=value2, parameter3=value3}