We can attach DockPanel.Dock to an Expander but we can't attach ToggleButton.IsChecked. Why?
<Expander DockPanel.Dock='Bottom'> <!--Compile-->
<Expander ToggleButton.IsChecked='True'> <!--Doesn't compile-->
I found the answer in the source:
From ToggleButton:
public static readonly DependencyProperty IsCheckedProperty =
DependencyProperty.Register(
"IsChecked",
typeof(bool?),
typeof(ToggleButton),
new FrameworkPropertyMetadata(
BooleanBoxes.FalseBox,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
new PropertyChangedCallback(OnIsCheckedChanged)));
Form DockPanel:
public static readonly DependencyProperty DockProperty =
DependencyProperty.RegisterAttached(
"Dock",
typeof(Dock),
typeof(DockPanel),
new FrameworkPropertyMetadata(
Dock.Left,
new PropertyChangedCallback(OnDockChanged)),
new ValidateValueCallback(IsValidDock));
Dock
is registered with RegisterAttached
method instead of Register
.