Share via


Naming Elements

Naming an element allows you to refer to it from another point in code. Some elements require a name, although you can specify a name for any element. You can use alpha-numeric characters as well as several punctuation characters and symbols:

<ColorFill Name="My*Named%ColorFill" Content="White" MinimumSize="10,10" />

However, the following characters cannot be used in a name and will result in an error:

& " < > ! .

You should also set a name for an element explicitly, rather than setting it through a property. For example, use Name="MyName" rather than Name="[ReferenceToName]".

See Also