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

  • Home
  • SEARCH
  • 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 908933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:47:43+00:00 2026-05-15T16:47:43+00:00

I want’ to define that every control of specific type inisde a grid gets

  • 0

I want’ to define that every control of specific type inisde a grid gets a Style. This is easy just put the styles with TargetType inside the grid resources. But what then if I wan’t to reuse this grid as a style?

I can create a grid style and have a setter to resources but can only put one style there.

<Style x:Key="GridStyle" TargetType="Grid">
    <Setter Property="Resources">
        <Setter.Value>
            <Style TargetType="TextBlock" BasedOn="{StaticResource MainText}" />
            <Style TargetType="{x:Type RowDefinition}">
                <Setter Property="Height" Value="Auto"/>
            </Style>
            <Style TargetType="Button" BasedOn="{StaticResource MainButton}" />
        </Setter.Value>
    </Setter>
</Style>

Won’t work because the setter can only put one style in.

This is probably something very simple but I’m not getting it and I don’t wan’t to repeat these styles in each and every grid.

  • 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-15T16:47:44+00:00Added an answer on May 15, 2026 at 4:47 pm

    If you put the Styles inside the Resources of the outer style, they will be in scope inside the grids:

    <Style x:Key="GridStyle" TargetType="Grid">
        <Style.Resources>
            <Style TargetType="TextBlock" BasedOn="{StaticResource MainText}" />
            <Style TargetType="{x:Type RowDefinition}">
                <Setter Property="Height" Value="Auto"/>
            </Style>
            <Style TargetType="Button" BasedOn="{StaticResource MainButton}" />
        </Style.Resources>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want to verify that my understanding of how this works. Have a C++ Class
Want to just confirm on following. Please verify if this is correct: 1. As
want to ask about void type, so I could know that it works or
want to drag element to specific div and if not dragged to this div
Want to do this: (EDIT: bad sample code, ignore and skip below) struct RECORD
want to know why String behaves like value type while using ==. String s1
want to create a temporary table that has an auto_increment field plus a field
I have a French site that I want to parse, but am running into
Want to detect the '\n' without going through each and every character of a
Want an applescript droplet that opens files in QuickTime and mutes them all. The

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.