Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Use the custom expression editor to set a property

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 drop-down list. More complex properties use the subproperty and collection editors. You can also use advanced 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 Microsoft Expression Blend user interface to set it.

To set a property using the custom expression editor

  1. In the Properties panel, click Advanced options Cc294528.12e06962-5d8a-480d-a837-e06b84c545bb(en-us,Expression.40).png 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 bolded values:

    • 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 noteTip

      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 Windows Presentation Foundation Control Library Cc294528.xtlink_newWindow(en-us,Expression.40).png.

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.
Show:
© 2015 Microsoft