[英]How can I create a dockable window in WPF (C#)?
Let's say you have a view (userControl) with its own XAML code, and another window (window) also with its own XAML code. 假设您有一个带有自己的XAML代码的视图(userControl),另一个窗口(窗口)也有自己的XAML代码。 Is there any way to be able to dock this window into the view (the view will rearrange the UI to accomodate the docked window), but also get the window out of the view if you want to move the window around?
有没有办法可以将此窗口停靠在视图中(视图将重新排列UI以容纳停靠的窗口),但如果要移动窗口,还可以将窗口移出视图?
Check out AvalonDock project. 查看AvalonDock项目。
AvalonDock is a docking windows control for WPF that lets you create customizable layouts using a full featured window docking system similar to what is found in many popular integrated development environements (IDEs) such as Visual Studio.
AvalonDock是WPF的停靠窗口控件,可让您使用类似于许多流行的集成开发环境(IDE)(如Visual Studio)中的全功能窗口对接系统来创建可自定义的布局。 It includes themes and samples to get you started.
它包括主题和示例,以帮助您入门。
Example of usage: 用法示例:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonDock="http://avalondock.codeplex.com"
Title="MainWindow" Height="434" Width="684">
<Grid>
<avalonDock:DockingManager x:Name="dockingManager">
<avalonDock:LayoutRoot>
<avalonDock:LayoutPanel Orientation="Horizontal">
<avalonDock:LayoutDocumentPane/>
<avalonDock:LayoutAnchorablePane DockWidth="150">
<avalonDock:LayoutAnchorable Title="Sample Tool Pane">
<TextBox/>
</avalonDock:LayoutAnchorable>
</avalonDock:LayoutAnchorablePane>
</avalonDock:LayoutPanel>
<avalonDock:LayoutRoot.LeftSide>
<avalonDock:LayoutAnchorSide>
<avalonDock:LayoutAnchorGroup>
<avalonDock:LayoutAnchorable Title="Autohidden Content">
<TextBox/>
</avalonDock:LayoutAnchorable>
</avalonDock:LayoutAnchorGroup>
</avalonDock:LayoutAnchorSide>
</avalonDock:LayoutRoot.LeftSide>
</avalonDock:LayoutRoot>
</avalonDock:DockingManager>
</Grid>
</Window>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.