milani_lucie
asked on
Dependency Property vs Attached Property - WPF
Hi,
I have the following statement:
Attached properties differ from normal dependency properties in that they are not wrapped in CLR properties (i.e. standard .NET properties).
Dependency Properties Example:
<Canvas>
<Rectangle Height="72" Width="131" Canvas.Left="74" Canvas.Top="77" />
</Canvas>
Attached Properties Example:
<DockPanel>
<Button x:Name="Button1" DockPanel.Dock="Left" />
</DockPanel>
Can you please let me know what is the difference between these two ? It looks like both are same but i am missing something !
Thanks
I have the following statement:
Attached properties differ from normal dependency properties in that they are not wrapped in CLR properties (i.e. standard .NET properties).
Dependency Properties Example:
<Canvas>
<Rectangle Height="72" Width="131" Canvas.Left="74" Canvas.Top="77" />
</Canvas>
Attached Properties Example:
<DockPanel>
<Button x:Name="Button1" DockPanel.Dock="Left" />
</DockPanel>
Can you please let me know what is the difference between these two ? It looks like both are same but i am missing something !
Thanks
ASKER
wdosanjos:
Can you please define in simple terms:
What are Attched Properties ? What are Dependency Properties ? As per your definition, Attached Properties are nothing but Dependency Properties but attached to child controls. Am i correct ?
Can be Dependency Properties exist without attaching to child controls ?
Thanks
Can you please define in simple terms:
What are Attched Properties ? What are Dependency Properties ? As per your definition, Attached Properties are nothing but Dependency Properties but attached to child controls. Am i correct ?
Can be Dependency Properties exist without attaching to child controls ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
More here:
Dependency Properties Overview
http://msdn.microsoft.com/en-us/library/ms752914.aspx
Attached Properties Overview
http://msdn.microsoft.com/en-us/library/ms749011.aspx