0
Attached Property<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
Mahender Sarangam<br />Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United ...
Attached Property<br />Attached property is kind of Dependency property defined in XAML.<br />For example, Canvas. Left is...
The Main advantage of Attached property is to allow different child elements to specify unique values for a property that ...
Code Snippet<br />publicstaticreadonlyDependencyPropertyTabStopProperty = DependencyProperty.RegisterAttached(<br />      ...
   <br />The value of every attached property is stored in the class the property is being attached to.<br /> For example ...
			Thank you<br />
Upcoming SlideShare
Loading in...5
×

Attached property

396

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
396
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Attached property"

  1. 1. Attached Property<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
  2. 2. Mahender Sarangam<br />Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United Health Group (UHG India Information Service Ltd.). Worked with Big Firms like Deloitte Consulting & Wipro Technology. <br />Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. <br />MCTS Certified in Web Technologies.<br />Blog : http://Msarangam.wordpress.com <br />
  3. 3. Attached Property<br />Attached property is kind of Dependency property defined in XAML.<br />For example, Canvas. Left is an attached property defined by the Canvas type , Storyboard.TargetProperty<br />Interesting feature about Attached property is that they are not defined in the type they are declared but you can use them in another different class hierarchy<br />“The attached properties are intended to be used as global properties that are settable on any type of object” - Microsoft Definition<br />
  4. 4. The Main advantage of Attached property is to allow different child elements to specify unique values for a property that is actually defined in a parent element.<br />Registering and using custom attached properties in Silverlight<br />Attached Property can only created if the class inherit from Dependency objects.<br />  Why we need attached properties?<br /> Because of dynamic extension of classes without inheritance<br /> Location of Property are stored, where there are defined, Use the property when you need and what you need it. <br />The attached property reports information to a service.<br />
  5. 5. Code Snippet<br />publicstaticreadonlyDependencyPropertyTabStopProperty = DependencyProperty.RegisterAttached(<br />        "TabStop",                   //Name of the property<br />        typeof( bool ),              //Type of the property<br />        typeof( TabPanel ),    // Type of the provider of the registered attached property<br />                null );                           //Callback invoked in case the property value has changed<br />publicstaticvoidSetMyProperty( DependencyObjectobj, stringpropertyValue ) { obj.SetValue( MyPropertyProperty, propertyValue ); } <br />publicstaticstringGetMyProperty( DependencyObjectobj ) { return ( string )obj.GetValue( MyPropertyProperty ); }<br />
  6. 6.    <br />The value of every attached property is stored in the class the property is being attached to.<br /> For example if you define value for the TabStop property of a button then this value is stored internally in the button, not in the TabPanel that registered it.<br />Canvas.Top – Define the distance for a control from the top edge of its container;Canvas.Left – Define the distance for a control from the left edge of its container;Canvas.ZIndex – Z Index of the control;Grid.Row – Define the row index for a control placed in a Grid container;Grid.Column – Define the row index for a control placed in a Grid container;ScrollViewer.HorizontalScrollBarVisibility – Define the visibility of the horizontal scrollbar;ScrollViewer.VerticalScrollBarVisibility – Define the visibility of the vertical scrollbar;ToolTipService.ToolTip – Define the tool tip associated with a control;<br />
  7. 7. Thank you<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×