I am reading WPF 4 Unleashed and I am obviously new to WPF (and C# & .NET in general)
In the book, found the following snipped of code:
<StackPanel TextElement.FontSize="30" TextElement.FontStyle="Italic"
Orientation="Horizontal" HorizontalAlignment="Center">
<Button MinWidth="75" Margin="10">Help</Button>
<Button MinWidth="75" Margin="10">OK</Button>
</StackPanel>
TextElement.FontSize
is an attached property. I don't understand why is it attached property ?
(Though, I do understand the concept of dependency property)
In Attached Properties Overview
on MS site, there is another snipped of code.
<DockPanel>
<CheckBox DockPanel.Dock="Top">Hello</CheckBox>
</DockPanel>
In this case, it makes sense as to why DockPanel.Dock
is an attached property - DockPanel
class contains dependency property DockProperty
.