哪些面板和容器允许重叠UI元素

时间:2018-04-11 17:49:22

标签: c# wpf containers overlapping panels

哪些面板和容器允许与不同的z-index重叠? (包括画布)

- 由于我被问到详细信息,这是代码的一部分:

 <DockPanel HorizontalAlignment="Left" Height="32" LastChildFill="False" Margin="10,0,0,10"
                               VerticalAlignment="Top">
                        <Rectangle Fill="{Binding (extensions:PaletteColor.FillBrush)}" Height="32" RadiusY="4"
                                   RadiusX="4"
                                   Stroke="#FF000000" Width="32" HorizontalAlignment="Left" VerticalAlignment="Top"
                                   MouseLeftButtonUp="TargetColorClick"
                                   ToolTip="{Binding (extensions:PaletteColor.Name)}" />

1 个答案:

答案 0 :(得分:0)

好的,我能够在Clemens支持下做到这一点:

<TextBlock TextWrapping="Wrap" Text="16"
                                   Margin="-32,0,0,0" Height="16"
                                   HorizontalAlignment="Center" />

- 回答另一个问题,我的XAML完全控制如下:

<ItemsControl ItemsSource="{Binding (local:MainWindow.CurrentPaletteSet)}" Width="400" Margin="665,67,14,-67">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <DockPanel HorizontalAlignment="Left" Height="32" LastChildFill="False" Margin="10,0,0,10"
                               VerticalAlignment="Top">
                        <Rectangle Fill="{Binding (extensions:PaletteColor.FillBrush)}" Height="32" RadiusY="4"
                                   RadiusX="4"
                                   Stroke="#FF000000" Width="32" HorizontalAlignment="Left" VerticalAlignment="Top"
                                   MouseLeftButtonUp="TargetColorClick"
                                   ToolTip="{Binding (extensions:PaletteColor.Name)}" />
                        <TextBlock TextWrapping="Wrap" Text="16"
                                   Margin="-32,0,0,0" Height="16"
                                   HorizontalAlignment="Center" />
                        <TextBlock TextWrapping="Wrap" Text="{Binding (extensions:PaletteColor.FullRgbString)}"
                                   Margin="5,0,0,0" Height="16"
                                   HorizontalAlignment="Left" DockPanel.Dock="Top" />
                        <TextBlock TextWrapping="Wrap" Text="{Binding (extensions:PaletteColor.FullHslString)}"
                                   Margin="5,0,0,0"
                                   Height="16" HorizontalAlignment="Left" DockPanel.Dock="Top" MinWidth="121" />
                    </DockPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel></ItemsControl>