wpf-devexpress-dot-xpf-dot-docking-dot-baselayoutitem-210a92b6.md
Gets or sets whether the item can be hidden (auto-hidden, for dock items). This is a dependency property.
Namespace : DevExpress.Xpf.Docking
Assembly : DevExpress.Xpf.Docking.v25.2.dll
NuGet Package : DevExpress.Wpf.Docking
public bool AllowHide { get; set; }
Public Property AllowHide As Boolean
| Type | Description |
|---|---|
| Boolean |
true, if the item can be hidden (auto-hidden, for dock items); otherwise, false.
|
Create an AutoHideGroup, add a panel to the group, and then add the group to the DockLayoutManager.AutoHideGroups collection.
<Window ...
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking">
<dxdo:DockLayoutManager>
<dxdo:DockLayoutManager.AutoHideGroups>
<dxdo:AutoHideGroup DockType="Right" AllowHide="True">
<dxdo:LayoutPanel Caption="Panel1"/>
</dxdo:AutoHideGroup>
</dxdo:DockLayoutManager.AutoHideGroups>
</dxdo:DockLayoutManager>
</Window>
Use the DockController‘s IDockController.Hide methods to auto-hide a specific dock item.
DockLayoutManager1.DockController.Hide(Panel1, Dock.Right);
DockLayoutManager1.DockController.Hide(Panel1, Dock.Right)
Use the DockLayoutManager.LayoutController object’s LayoutController.Hide method to hide Layout items.
When you set the LayoutPanel‘s AutoHide property to true, the LayoutPanel DataContext can be changed, because the panel is placed inside a new AutoHideGroup.
Subscribe to the LayoutPanel’s DataContextChanging event to catch the moment when the panel’s DataContext is changed.
When this occurs, you can specify your own DataContext for the panel. Subscribe to the DockManager.DockOperationCompleted event to catch the moment when your panel is hidden, and specify your own DataContext.
The following code sample changes ContentPanel LayoutPanel ‘s DataContext when the panel is hidden:
private void dockManager_DockOperationCompleted(object sender, DevExpress.Xpf.Docking.Base.DockOperationCompletedEventArgs e) {
if(e.Item.Name == "ContentPanel" && e.DockOperation == DockOperation.Hide ) {
e.Item.DataContext = YourDataContext;
}
}
Private Sub dockManager_DockOperationCompleted(ByVal sender As Object, ByVal e As DevExpress.Xpf.Docking.Base.DockOperationCompletedEventArgs)
If e.Item.Name = "ContentPanel" AndAlso e.DockOperation = DockOperation.Hide Then
e.Item.DataContext = YourDataContext
End If
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the AllowHide property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
wpf-diagram-mdi/CS/MainWindow.xaml#L158
AllowDock="False"
AllowHide="False"
AllowMaximize="False"
var target = dockLayoutElementDragInfo.Target;
if ((dockLayoutElementDragInfo.DropTarget is HiddenItemElement || dockLayoutElementDragInfo.DropTarget is HiddenItemsListElement) && dockLayoutElementDragInfo.Item.AllowHide) {
LayoutItemType itemType = dockLayoutElementDragInfo.Item.ItemType;
Dim target = dockLayoutElementDragInfo.Target
If(TypeOf dockLayoutElementDragInfo.DropTarget Is HiddenItemElement OrElse TypeOf dockLayoutElementDragInfo.DropTarget Is HiddenItemsListElement) AndAlso dockLayoutElementDragInfo.Item.AllowHide Then
Dim itemType As LayoutItemType = dockLayoutElementDragInfo.Item.ItemType
See Also