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 7184643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:14:36+00:00 2026-05-28T18:14:36+00:00

I have a default TextBlock style defined in App.xaml, which seems to also affect

  • 0

I have a default TextBlock style defined in App.xaml, which seems to also affect the text color of ComboBox items. Now, how do I explicitly set the text color of a ComboBox defined in my main window? (I’d like to keep the default style, but have the combobox text color as, say, blue instead of red…)

App.xaml

<Application x:Class="WpfApplication1.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="Foreground" Value="Red" />
    </Style>
</Application.Resources>

MainWindow.xaml

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow">
<Grid>
    <ComboBox Name="comboBox1" SelectedIndex="0" HorizontalAlignment="Left" VerticalAlignment="Top">
        <ComboBoxItem Content = "Item1"/>
        <ComboBoxItem Content = "Item2"/>
        <ComboBoxItem Content = "Item3"/>
    </ComboBox>
</Grid>

Things I’ve tried:

  1. Set Combobox.Foreground
  2. Set TextElement.Foreground
  3. Set TextBlock.Foreground
  4. Define another implicit TextBlock style in ComboBox.Resources
  5. Define another implicit TextBlock style in Grid.Resources
  6. Define another implicit TextBlock style in Window.Resources
  • 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-05-28T18:14:38+00:00Added an answer on May 28, 2026 at 6:14 pm

    Most implicit TextBlock styles will stop at control boundaries, unless you put them in Application.Resources

    For example, placing your style in Window.Resources will make it apply to all <TextBlock> objects, but not to text inside other Control Templates such as a ComboBox or a Button

    I would suggest moving your style into Window.Resources, and then styling your ComboBox items to have whatever foreground color you want.

    <ComboBox.Resources>
        <Style TargetType="{x:Type ComboBoxItem}">
            <Setter Property="Foreground" Value="Blue" />
        </Style>
    </ComboBox.Resources>
    

    If you want to keep it in Application.Resources, then I suspect you need to track down what x:Static brush key is used for setting the TextBlock.Text color and overwrite that in your ComboBox.Resources

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

Sidebar

Related Questions

I have a custom style for my 'default' Buttons, and also created a custom
In my application, I have defined the following style for TextBlocks. <Style TargetType={x:Type TextBlock}>
I have a TextBlock in my XAML that has its text bound to a
I have a TextBlock - which is collapsed by default and will be visible
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
Say I have default content on the left side of my application, which is
I want to be able to have default text like Enter content here... appear
I have a default concrete type defined in a registry: ForRequestedType<IXRepository>() .TheDefaultIsConcreteType<CacheXRepository>(); The ChaceXRepository
In my file.xaml, how can I set the TextBlock default size, so that I
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>

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.