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.

Cc294528.alert_note(en-us,Expression.10).gifNote:

Custom expressions, subproperty editors, collection editors, data-binding, template binding, and resources are not supported in Microsoft Silverlight 1.0 projects.

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 the Advanced property options Cc294528.d6ba8f4a-b8a2-445a-af0b-a267dfade6e1(en-us,Expression.10).png 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 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.10).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 topics on .

Community Additions

ADD
Show:
© 2014 Microsoft