In AvalonDock, is it possible to modify a LayoutAnchorablePane
's CanClose
property dynamically at runtime? I would like to prevent/lock layout changes unless the user specifically desires to do so and turns it on.
I have tried the following approaches:
DependencyProperty
so something like this doesn't work: <dock:LayoutAnchorable CanClose="{Binding CanClose}">
CanClose
property: Changing the LayoutAnchorablePane
's CanClose
property in code-behind is not possible because the property is read-only.According to the source code of LayoutAnchorablePane
:
#region CanClose
public bool CanClose
{
get
{
return Children.All( a => a.CanClose );
}
}
#endregion
the CanClose
property depends on all children of the pane, so one way to change the value of CanClose
of a LayoutAnchorablePane
is to set all its children's CanClose
property to the value you want. Below is an example:
...
foreach(var child in pane.Children)
{
child.CanClose = true; // or false.
}
...