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 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.

  1. In the Properties panel, click Advanced property options Cc294528.12e06962-5d8a-480d-a837-e06b84c545bb(en-us,Expression.30).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}}
      
      Cc294528.alert_tip(en-us,Expression.30).gifTip:

      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.

Community Additions

ADD
Show:
© 2014 Microsoft