这是indexloc提供的服务,不要输入任何密码
Skip to content

VS2013 theme: how can I override the accent color used for active headers? #514

@deanfredr

Description

@deanfredr

I would like to create my own color palette but I don't seem to be able to locate the proper override to get rid of the Blue Headers for selected panes.

Image

Here are my ThemeOverrides:

<!-- 🟣 Global Menu Styling -->
<Style TargetType="Menu" BasedOn="{x:Null}">
    <Setter Property="Background" Value="#2B2B2F"/>
    <Setter Property="Foreground" Value="{StaticResource BrushText}"/>
    <Setter Property="FontFamily" Value="{StaticResource FontSecondary}"/>
    <Setter Property="FontSize" Value="14"/>
</Style>

<!-- 🟣 MenuItem Styling -->
<Style TargetType="MenuItem" BasedOn="{x:Null}">
    <Setter Property="Background" Value="#2B2B2F"/>
    <Setter Property="Foreground" Value="{StaticResource BrushText}"/>
    <Setter Property="Padding" Value="10,3"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="MenuItem">
                <Border Background="{TemplateBinding Background}">
                    <ContentPresenter
                        ContentSource="Header"
                        Margin="8,2"
                        RecognizesAccessKey="True"/>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsHighlighted" Value="True">
                        <Setter Property="Background" Value="#3A3950"/>
                        <Setter Property="Foreground" Value="{StaticResource BrushAccent}"/>
                    </Trigger>
                    <Trigger Property="IsSubmenuOpen" Value="True">
                        <Setter Property="Background" Value="#3A3950"/>
                        <Setter Property="Foreground" Value="{StaticResource BrushAccent}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

<!-- 🟣 ContextMenu Styling -->
<Style TargetType="ContextMenu" BasedOn="{x:Null}">
    <Setter Property="Background" Value="#2B2B2F"/>
    <Setter Property="Foreground" Value="{StaticResource BrushText}"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush" Value="#3A3950"/>
</Style>

<!-- === TOOL WINDOW HEADER OVERRIDES (AnchorablePane / Navigation / Inspector / Console) === -->

<!-- Active header background -->
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBackgroundActive"
                 Color="#84676C" />
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBorderActive"
                 Color="#E6B7A9" />
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleForegroundActive"
                 Color="#F5DEB3" />

<!-- Inactive header -->
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBackgroundInactive"
                 Color="#2B2B2F" />
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBorderInactive"
                 Color="#3A3950" />
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleForegroundInactive"
                 Color="#D4A373" />

<!-- Hover / mouseover -->
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBackgroundHover"
                 Color="#6C5550"/>
<SolidColorBrush x:Key="AvalonDockThemeVS2013AnchorableTitleBorderHover"
                 Color="#D4A373"/>

<!-- Fallbacks for older versions -->
<SolidColorBrush x:Key="AvalonDockThemeVS2013ToolWindowHeaderActiveBackground"
                 Color="#84676C"/>
<SolidColorBrush x:Key="AvalonDockThemeVS2013ToolWindowHeaderActiveBorder"
                 Color="#E6B7A9"/>
<SolidColorBrush x:Key="AvalonDockThemeVS2013ToolWindowHeaderActiveForeground"
                 Color="#F5DEB3"/>

I also am unable to get layout saving to work...I create a %AppData%\TalkYourVision\layout.config.bak file but it doesn't save anything correctly. My initial layout is:

Image

I make these changes:

Image

Here is my saving and loading logic:

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    // --- Safe load ---
    try
    {
        if (File.Exists(LayoutConfigPath))
        {
            var serializer = new XmlLayoutSerializer(DockManager);
            serializer.Deserialize(LayoutConfigPath);

            if (!DockManager.Layout.Descendents().Any())
            {
                File.Delete(LayoutConfigPath);
                MessageBox.Show("Layout file was empty and has been reset.");
            }
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Layout load failed: {ex.Message}");
    }
}

protected override async void OnClosing(System.ComponentModel.CancelEventArgs e)
{
    base.OnClosing(e);

    try
    {
        DockManager.UpdateLayout();       // force commit any pending state
        await Task.Delay(250);             // allow hide animations to complete

        var dir = Path.GetDirectoryName(LayoutConfigPath);
        if (!Directory.Exists(dir))
            Directory.CreateDirectory(dir);

        // only save if panes exist (prevents empty layout)
        if (DockManager.Layout.Descendents().Any())
        {
            var serializer = new XmlLayoutSerializer(DockManager);
            serializer.Serialize(LayoutConfigPath);
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Layout save failed: {ex.Message}");
    }
}

}

but when I restart the app it is back to the original layout

Your assistance would be much appreciated

Dean Fredrickson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions