Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8055639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:27:05+00:00 2026-06-05T08:27:05+00:00

Below is part of a style for a TabItem, for which I am getting

  • 0

Below is part of a style for a TabItem, for which I am getting binding errors similar to the one shown below.

How can I clean the code up?

Error

System.Windows.Data Error: 40 : BindingExpression path error: 'HoverForeground' property not found on 'object' ''TabItem' (Name='')'. BindingExpression:Path=HoverForeground; DataItem='TabItem' (Name=''); target element is 'GlyphButton' (Name='HideButton'); target property is 'Foreground' (type 'Brush')

TabItem style

<Style x:Key="OrangeTabItemStyle" TargetType="{x:Type TabItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
                <Border AllowDrop="true" ToolTip="{Binding DisplayName}">
                    <Border Name="Border" Background="Transparent" BorderBrush="Transparent" BorderThickness="1,1,1,0" CornerRadius="2,2,0,0">
                        <DockPanel x:Name="TitlePanel" TextElement.Foreground="{StaticResource FileTabTextBrush}">
               ******             <ctrl:GlyphButton x:Name="HideButton" 
                        DockPanel.Dock="Right" 
                        GlyphForeground="Transparent" 
                        HoverBackground="{StaticResource ToolWindowButtonHoverActiveBackgroundBrush}" 
                        HoverBorderBrush="{StaticResource ToolWindowButtonHoverActiveBorderBrush}" 
              *****          HoverForeground="{StaticResource ToolWindowButtonHoverActiveGlyphForegroundBrush}" 
                        PressedBackground="{StaticResource ToolWindowButtonPressedBackgroundBrush}" 
                        PressedBorderBrush="{StaticResource ToolWindowButtonPressedBorderBrush}" 
                        PressedForeground="{StaticResource ToolWindowButtonPressedActiveGlyphForegroundBrush}"
                        HoverBorderThickness="1" PressedBorderThickness="1" Margin="3,2,3,4" 
                        Command="{Binding CloseCommand}"
                        CommandParameter="{Binding}"
                        ToolTip="Close">
                                <Path x:Name="CloseButtonStroke" Width="10" Height="8" Stretch="Uniform" 
                                      Data="F1 M 0,0 L 2,0 5,3 8,0 10,0 6,4 10,8 8,8 5,5 2,8 0,8 4,4 0,0 Z" 
                            Fill="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource Self}}" />
                            </ctrl:GlyphButton>

                            <ContentPresenter x:Name="Content" HorizontalAlignment="Stretch" Margin="4,2,4,4" VerticalAlignment="Stretch" 
                                              RecognizesAccessKey="true" ContentSource="Header" />
                        </DockPanel>
                    </Border>
                    <Border.InputBindings>
                        <KeyBinding Command="{Binding CloseCommand}" Key="F4" Modifiers="Control" />
                    </Border.InputBindings>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter TargetName="Border" Value="{StaticResource FileTabIsMouseOverBorderBackgroundBrush}" Property="Background" />
                        <Setter TargetName="Border" Value="{StaticResource FileTabIsMouseOverBorderBrush}" Property="BorderBrush" />
                        <Setter TargetName="TitlePanel" Value="{StaticResource FileTabIsMouseOverTextForegroundBrush}" Property="TextElement.Foreground" />
                        <Setter TargetName="HideButton" Value="{StaticResource FileTabIsMouseOverGlyphForegroundBrush}" Property="GlyphForeground" />
                    </Trigger>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Panel.ZIndex" Value="1" />
                        <Setter TargetName="Border" Value="{StaticResource FileTabIsSelectedBackgroundBrush}" Property="Background" />
                        <Setter TargetName="Border" Value="{StaticResource FileTabIsSelectedBackgroundBrush}" Property="BorderBrush" />
                        <Setter TargetName="Border" Property="BorderThickness" Value="0" />
                        <Setter TargetName="Border" Property="Padding" Value="0,1,0,0" />
                        <Setter TargetName="HideButton" Property="Margin" Value="3" />
                        <Setter TargetName="TitlePanel" Value="{StaticResource FileTabIsSelectedTextForegroundBrush}" Property="TextElement.Foreground" />
                        <Setter TargetName="HideButton" Value="{StaticResource FileTabIsSelectedGlyphForegroundBrush}" Property="GlyphForeground" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

GlyphButton control

public class GlyphButton : Button
{

    public static readonly DependencyProperty HoverForegroundProperty = DependencyProperty
        .Register("HoverForeground", typeof(Brush), typeof(GlyphButton));

    public Brush HoverForeground
    {
        get { return (Brush) GetValue(HoverForegroundProperty); }
        set { SetValue(HoverForegroundProperty, value); } 
    }

    // other properties similar to this omitted....
}

EDIT – GlyphButton Style

<Style TargetType="{x:Type ctrl:GlyphButton}">
    <Setter Property="Width" Value="{Binding Path=ActualHeight, RelativeSource={RelativeSource Self}}" />
    <Setter Property="Foreground" Value="{Binding Path=GlyphForeground, RelativeSource={RelativeSource Self}}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ctrl:GlyphButton}">
                <Border 
                    Name="Border" Background="{TemplateBinding Background}" 
                    BorderBrush="{TemplateBinding BorderBrush}" 
                    BorderThickness="{TemplateBinding BorderThickness}">
                    <ContentPresenter />
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter TargetName="Border" Value="{Binding HoverBackground , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="Background" />
                        <Setter TargetName="Border" Value="{Binding HoverBorderBrush , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="BorderBrush" />
                        <Setter TargetName="Border" Value="{Binding HoverBorderThickness , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="BorderThickness" />
                        <Setter Value="{Binding HoverForeground , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="Foreground" />
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="Border" Value="{Binding PressedBackground , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="Background" />
                        <Setter TargetName="Border" Value="{Binding PressedBorderBrush , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="BorderBrush" />
                        <Setter TargetName="Border" Value="{Binding PressedBorderThickness , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="BorderThickness" />
                        <Setter Value="{Binding PressedForeground , RelativeSource={RelativeSource TemplatedParent}}" 
                                Property="Foreground" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:27:06+00:00Added an answer on June 5, 2026 at 8:27 am

    Look at Setter Value=”{Binding HoverForeground , RelativeSource={RelativeSource TemplatedParent}}” – it Gets a reference to the template parent of this element and try to find property HoverForeground. Templated parent for your controltemplate is a Tab control (in first style)…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the part of code below I am still getting this error: syntax error,
I have part of the code below: while($array = $result->fetch_assoc() ){ $second_query = INSERT
Below, I inserted a code written by Ray Konopka (part of the Coderage presentation).
In the code below, I think I messed up this part: if ( (1
This is actually a three-part question, which I'll explain below, but the questions are:
had a two part question with regard to below contrived c++ code snippet :
Can I apply Style to the output of Labeled in the below ? Manipulate[\[Lambda],
I prefer to have the rc error-code return style of error management. I agree
In code below, when you access the style property, I want it to be
So im stuck on a few things in each part below, they are pretty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.