Content Index Search
 

Using the custom expression editor

In the Properties panel, you can set properties in numerous ways. At the simplest level, you can enter a value, select a button, or select a value from dropdown list. More complex properties use the sub-property and collection editors. You can also use advanced property options to data bind, template bind, or apply a resource to a property.

The following procedure shows you how to set various values using the custom expression editor. The custom expression editor supports XAML syntax, which means that it acts like a miniature XAML viewer for the property value. This is useful if you know the syntax of the XAML value, and you want to quickly paste it into the property value without going through the steps in the Expression Blend user interface to set it.

To set a property using the custom expression editor

  1. In the Properties panel, click the Advanced property options Advanced property options button beside the property that you want to set, and then click Custom Expression.
    The Custom Expression editor appears.
  2. Type or paste in the XAML value for your property. For example, you could use one of the following syntax suggestions, changing the strings in red:
    • To bind the property to a data source or another property, you could enter something like the following:
        {Binding Mode=Mode, Source={StaticResource DataSourceName}, XPath=path}
        {Binding Path=PropertyName, ElementName=ElementName, Mode=Mode}
    • To set the property to a style or brush resource, you could enter something like the following:
        {DynamicResource ResourceKey}
        {DynamicResource {x:Static SystemColors.ColorName}}
    Tip You can view the XAML value of any property by opening the custom expression editor, even if the property is a data binding, a resource reference, an object reference, or a simple value. This is useful if you want to copy the syntax of one property in order to paste it into the custom expression editor of another property.
    You can also find XAML syntax and examples in the Control Library topics on MSDN.