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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:02:11+00:00 2026-05-25T13:02:11+00:00

I have a resource dictionary in my WPF application which contains the style information

  • 0

I have a resource dictionary in my WPF application which contains the style information for the various controls.

Can it be used like the way we use in CSS in HTML? For example

 p
 {
   margin:20px;
   font:Tahoma;
  }

this applies to all “p” tags in HTML. We dont have to specifically mention that in the HTML for “p” tag.

Is the same approach applicable in WPF, or do we have to specifically
mention the style

<TextBlock Text="Test" Style="{DynamicResource SomeTextblockStyle}" />

in the XAML

  • 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-25T13:02:12+00:00Added an answer on May 25, 2026 at 1:02 pm

    You can certainly set a default style for each type. You can do this within your Generic.xaml, note that I am not providing a key.

    <Style TargetType="{x:Type Button}">
         <Setter Property="Height" Value="25"/>
         <Setter Property="Foreground" Value="White"/>
    </Style>
    

    This will style every instance of a Button within your application as such.

    If you were go to a XAML file and define an instance of a Button, overriding the Foreground value, that local instance will take precedence over the global style.

    <Button Foreground="Black"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ComponentResourceKey defined in my resource dictionary like this: <Style x:Key={ComponentResourceKey TypeInTargetAssembly={x:Type
I have developed a WPF application. I have a one resource dictionary file in
I'm building a WPF application in which I have a need to get the
I am trying to have to skin resource dictionaries for a wpf application that
I have a chromeless button in a WPF application that uses the XAML style
I have a WPF application which I need to integrate with WinForms. As suggested
I have used a custom class to implement shared resource functionality in my WPF
Ok, I have a ResourceDictionary definition that I used for a WPF app below:
I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in
Resource dictionary 03-11-2010 10:56 AM | I have two different projects. I linked a

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.