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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:16:52+00:00 2026-05-26T13:16:52+00:00

This is a style I apply to all the textblocks in the project which

  • 0

This is a style I apply to all the textblocks in the project which is in the App.XAML file.

  <Style TargetType="{x:Type TextBlock}">
        <Setter Property="Foreground" Value="Orange" />
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

But this style changes the Foreground colour of all my menu items and the buttons in my project, even if I specify the foreground color to these controls as black. Any solution to this issue?

My XAML for buttons is below:

<Button x:Name="BtnEdit" Content="Details" Click="BtnEdit_Click" Margin="10,0,0,0"  />   
  • 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-26T13:16:52+00:00Added an answer on May 26, 2026 at 1:16 pm

    Move your style from App.xaml App.Resources to MainWindow.xaml Window.Resources.
    If you need your style in more than one window or page then move it to a separate resource dictionary xaml file (add -> new -> wfp -> resource dictionary) as per this article:
    resource dictionarys
    Merge the dictionary into the Window.Resources not the Application.Resources as in the example! eg

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="Dictionary1.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to apply a style in code ike this: TextBlock.Style = TryFindResource(MyStyle) as
I want to apply a style to all classes derived from Control. Is this
I was looking at this question and noticed that placing an implicit TextBlock style
I declared a style that I want to apply to ALL the buttons in
Is it possible to apply style to all class X only if it's of
I have styled my Menu/ContextMenu/MenuItem controls in App.xaml so that those styles apply to
I want to apply a style to all <p> and <input> elements of the
I'm using asp.net website and I need to apply css style to all text
In WPF I could apply a style to a target type without giving it
I need to apply style=text-decoration: none; to all of my <a> tags that contain

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.