如何在AvalonDock中更改锚窗格背景?

时间:2016-09-01 10:40:34

标签: c# wpf xaml avalondock

我的GUI有一个简单的.xaml文件:

<Window x:Class="WpfApplication5.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xced="http://schemas.xceed.com/wpf/xaml/avalondock"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <xced:DockingManager Background="Gray">
            <xced:LayoutRoot>
                <xced:LayoutPanel>
                    <xced:LayoutAnchorablePane>
                        <xced:LayoutAnchorable>

                        </xced:LayoutAnchorable>
                    </xced:LayoutAnchorablePane>
                </xced:LayoutPanel>
            </xced:LayoutRoot>
        </xced:DockingManager>        
    </Grid>
</Window>

我想要做的就是更改背景,我可以通过Background属性实现这一点,但它与锚点窗格不一致,如图所示:

enter image description here

我怎样才能将白色变为灰色?

1 个答案:

答案 0 :(得分:0)

主题化是解决此问题的方法-您可以找到主题版本(在Internet上可以找到一些版本),也可以在AvalonDock DLL的Generic.xaml文件中编辑/替代项目。< / p>

例如在AnchorablePineTitle的第400行处:

              <Button x:Name="PART_HidePin"
                      Grid.Column="3"
                      Focusable="False"
                      Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                      Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                      Command="{Binding Path=LayoutItem.HideCommand, RelativeSource={RelativeSource TemplatedParent}}"
                      ToolTip="{x:Static avalonDockProperties:Resources.Anchorable_BtnClose_Hint}">
                <Border Background="White">
                  <Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/PinClose.png">
                  </Image>
                </Border>
</Button>