Attached Properties

Learner
Posted by in WPF category on for Beginner level | Views : 8707 red flag

Attached Properties : properties that may apply to several controls but are defined in a different class.In WPF,they are basically used to control layout.
It took some time for me to understand what exactly are Attached Properties.I will explain you in a very simple manner so that you can have brief knowledge about it and by getting the basic idea can explore more.

Attached Properties : properties that may apply to several controls but are defined in a different class.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.

Example :
<TextBox ... Grid.Row="0">
[Place question here.]
</TextBox>

Here defining type is the Grid class, and the property is Row.


Page copy protected against web site content infringement by Copyscape

About the Author

Learner
Full Name: Nikki Verma
Member Level: Starter
Member Status: Member
Member Since: 12/16/2008 12:38:53 AM
Country:



Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)