2013-05-21 27 views
0

enter image description here如何创建一个悬停的工具栏

如何创建一个悬停的工具栏? 单击展开工具栏不会缩小画布。

扩展器适用于扩展,但画布会缩小。

<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> 
+1

在那里,我删除了你的评论。 – BoltClock

回答

3

你可以把它们放在一个Grid没有行或列覆盖的东西,你的工具栏的大小是一个独立的事情(你仍然可以使用该扩展器)。

1

http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.zindex.aspx

Panel.ZIndex可能是解决方案。

<Grid x:Name="LayoutRoot"> 
<Grid x:Name="Toolbar" Panel.ZIndex="1000" Visibility="Collapsed"> 
    </Grid> 
    <canvas /> 
</Grid> 
+3

请注意,ZIndex只有在您没有按照Z-index-wise(例如Z-index-wise)的顺序添加控件时才相关。如果你添加一个'Button'作为第一个控件,但是需要它在顶部而不是在底部,因为它通常是。 –