Sunday 7 July 2013

Attached Properties in WPF

Posted by Rahul at 10:36

An attached property is a property that is declared by one control and attached to another. It allows the inclusion of additional information with a control for later use by an external source.

An attached property is a special form of dependency property that can effectively be attached to arbitrary objects. This may sound strange at first, but this mechanism has several applications in WPF.They are basically used to control layout.

Every control has its own set of intrinsic properties. Let's take an example of text box which has a specific font, text color, and text content as dictated by properties such as FontFamily, Foreground, and Text.)

Now when you place a control inside a container it gains additional features, depending on the type of container.
For example, if you place a text box inside a grid, you need to be able to choose the grid cell where it’s positioned.) These additional details are set using attached properties.

Attached properties always use a two-part name in this form:

DefiningType.
PropertyName.

This two-part naming syntax allows the XAML parser to distinguish between a normal property and an attached property. 






If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to know WPF | Template by Blogger Widgets

Home | About | Top