我是wpf的新手.我必须ToolBar像ms-office 2003工具栏一样在wpf中创建一个浮动.所以我可以把它放在顶部 - 底部,左 - 右,就像2003年办公室一样.
请帮我 .......................
bit*_*onk 11
对于普通对接,您将使用DockPanel:
<DockPanel>
<Button DockPanel.Dock="Top">This would be a toolbar at the top</Button>
<Butto>This would the main work area</Button>
</DockPanel>
<DockPanel>
<Button DockPanel.Dock="Left">This would be a toolbar at the left</Button>
<Button>This would the main work area</Button>
</DockPanel>
Run Code Online (Sandbox Code Playgroud)
您可以使用更适合您需求的类,而不是Button.
但是当你需要一个带有浮动窗口的窗口系统时,你将不得不恢复到第三方库,因为WPF没有它,并且很难自己滚动.这是一些库:
如果您真正需要的是停靠浮动工具栏(而不是其他窗口),则可以将ToolBar类与ToolBarTray类结合使用.但是您需要编写代码来检测拖动,从可视树中删除ToolBar元素,然后将其作为根视觉添加到您自己的Window或HwndSource.然后,您需要检测窗口何时位于放置区域以将ToolBar从窗口移动到主窗口的可视树并关闭另一个窗口.
| 归档时间: |
|
| 查看次数: |
12406 次 |
| 最近记录: |