Thursday, March 13, 2008

Markup Extensions

When you want to set a property value to an object that already exists, or you want to set a property value dynamically, by binding it to a property in another control, you need to use a markup extension-specialized syntax that sets a property in a nonstandard way.

Wednesday, March 12, 2008

Complex Properties:Property-element syntax

With property-element syntax, we can add a child element with a name in the form Parent. PropertyName. For example, the Grid has a Background property that allows you to supply a brush that's used to paint the area behind the controls. If you want to use a complex brush-one more advanced than a solid color fill-you'll need to add a child tag named Grid.Background, as shown here:

Tuesday, March 11, 2008

RuntimeNameProperty related

The RuntimeNameProperty indicates which property should be treated as the name for instances of that type. The FrameworkElement class includes the RuntimeNameProperty attribute.

In a traditional Windows Forms application, every control has a name. In a WPF application, the only elements that have names are ones that you want to manipulate programmatically.

This simplifies your markup, and allows you to easily distinguish between fixed and dynamic portions of your user interface.