c# - 如何创建悬停工具栏

标签 c# wpf mvvm

如何创建一个悬停的工具栏?
单击以展开工具栏不会收缩 Canvas 。

扩展器用于扩展,但是 Canvas 会缩小。

<UserControl x:Class="smartgrid.studio.View.GraphicEditorView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:model="clr-namespace:smartgrid.studio.Model"
         xmlns:studio="clr-namespace:smartgrid.studio"
         xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
         mc:Ignorable="d" 
         d:DesignHeight="1000" d:DesignWidth="1000">
<DockPanel>
    <Expander DockPanel.Dock="left" Header ="Toolbar" FontSize="18" ExpandDirection="Up">
        <TreeView Name="GraphicEditorEntityTree" Background="Transparent" BorderBrush="Transparent" ItemsSource="{Binding GraphicEditorEntities}"/>
    </Expander>
    <Canvas/>
</DockPanel>
</UserControl>

最佳答案

您可以通过将它们放置在没有行或列的Grid中来覆盖它们,工具栏的大小是独立的事情(您仍然可以使用扩展器)。

关于c# - 如何创建悬停工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16674199/

相关文章:

c# - 找不到导入的项目 "C:\Microsoft.CSharp.targets"

mvvm - MapOverlay 绑定(bind)不起作用

c# - WPF中的MVVM如何与viewmodel通信

c# - WPF隐藏一行,但空白区域不会被清除

c# - 多实例依赖属性

mvvm - 组合框上 KeyDown 的签名

c# - 如何使用 XAML 在整个容器(如 Panel 或 GroupBox)上设置 IsReadOnly/IsEnabled?

c# - 无法识别的属性disableAlternativeTemplates

c# - Delphi 扩展到 C#

c# - ConcurrentDictionary 和 Clear() 函数。使值导出线程安全而不会丢失数据