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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:38:05+00:00 2026-06-07T18:38:05+00:00

I’m trying to get a style to apply another style to elements of a

  • 0

I’m trying to get a style to apply another style to elements of a certain type. Similar to CSS where you would do

div a  
{  
    background-color:red;  
}

To apply a red background to all <a> elements that are contained by <div> elements.

Specifically, I’m trying to get all TableCells contained within a TableRowGroup with a certain style to have their borders changed.

I have the following solution where each cell style is set individually.

<Table>
    <Table.Columns>
        <TableColumn/>
        <TableColumn/>
    </Table.Columns>

    <Table.Resources>
        <Style x:Key="HeaderStyle" TargetType="{x:Type TableRowGroup}">
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="FontSize" Value="12"/>
        </Style>

        <Style x:Key="HeaderCellStyle" TargetType="{x:Type TableCell}">
            <Setter Property="BorderThickness" Value="0,1,0,1" />
            <Setter Property="BorderBrush" Value="Black" />
        </Style>
    </Table.Resources>

    <TableRowGroup Name="TableColumnHeaders" Style="{StaticResource HeaderStyle}">
        <TableRow>
            <TableCell Style="{StaticResource HeaderCellStyle}">
                <Paragraph>
                    Description
                </Paragraph>
            </TableCell>
            <TableCell Style="{StaticResource HeaderCellStyle}">
                <Paragraph>
                    Amount
                </Paragraph>
            </TableCell>
        </TableRow>
    </TableRowGroup>
</Table>

This is clearly not preferred as it bloats the xaml when there are many cells.

I’ve tried the following with no success.

<Table.Resources>
    <Style x:Key="HeaderStyle" TargetType="{x:Type TableRowGroup}">
        <Style.Resources>
            <Style TargetType="{x:Type TableCell}">
                <Setter Property="BorderThickness" Value="0,1,0,1" />
                <Setter Property="BorderBrush" Value="Black" />
            </Style>
        </Style.Resources>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>
</Table.Resources>

This also doesn’t work for some reason, though is valid

<Table.Resources>
    <Style x:Key="HeaderStyle" TargetType="{x:Type TableRowGroup}">
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="TableCell.BorderThickness" Value="0,1,0,1" />
        <Setter Property="TableCell.BorderBrush" Value="Black" />
    </Style>
</Table.Resources>

There’s going to be a few row groups each with their own cell style and each containing many cells. Please tell me there’s a better way.

  • 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-07T18:38:07+00:00Added an answer on June 7, 2026 at 6:38 pm

    Update based on your comment

    Based on your comment, I believe your problem could be easily solved using Style inheritance. Below is an example of using 2 different Cell Styles on different TableRowGroups:

    <Table>
        <Table.Resources>
    
            <Style x:Key="HeaderCellStyle" TargetType="{x:Type TableCell}">
                <Setter Property="BorderThickness" Value="0,1,0,1" />
                <Setter Property="BorderBrush" Value="Black" />
                <Setter Property="TextAlignment" Value="Center" />
                <Setter Property="FontStyle" Value="Italic" />
                <Setter Property="Padding" Value="5" />
            </Style>
    
            <Style x:Key="FooterCellStyle" BasedOn="{StaticResource HeaderCellStyle}" TargetType="{x:Type TableCell}">
                <Setter Property="Background" Value="AliceBlue" />
                <Setter Property="TextAlignment" Value="Right" />
                <Setter Property="FontWeight" Value="Bold" />
            </Style>
    
            <Style x:Key="HeaderTableRowGroupStyle" TargetType="{x:Type TableRowGroup}">
                <Style.Resources>
                    <Style BasedOn="{StaticResource HeaderCellStyle}" TargetType="{x:Type TableCell}" />
                </Style.Resources>
            </Style>
    
            <Style x:Key="FooterTableRowGroupStyle" TargetType="{x:Type TableRowGroup}">
                <Style.Resources>
                    <Style BasedOn="{StaticResource FooterCellStyle}" TargetType="{x:Type TableCell}" />
                </Style.Resources>
            </Style>
    
        </Table.Resources>
        <Table.Columns>
            <TableColumn />
            <TableColumn />
            <TableColumn />
            <TableColumn />
        </Table.Columns>
    
        <!--  This TableRowGroup hosts a header row for the table.  -->
        <TableRowGroup Style="{StaticResource HeaderTableRowGroupStyle}">
            <TableRow>
                <TableCell />
                <TableCell>
                    <Paragraph>Gizmos</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>Thingamajigs</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>Doohickies</Paragraph>
                </TableCell>
            </TableRow>
        </TableRowGroup>
    
        <!--  This TableRowGroup hosts the main data rows for the table.  -->
        <TableRowGroup>
            <TableRow>
                <TableCell>
                    <Paragraph>Blue</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>1</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>2</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>3</Paragraph>
                </TableCell>
            </TableRow>
            <TableRow>
                <TableCell>
                    <Paragraph>Red</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>1</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>2</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>3</Paragraph>
                </TableCell>
            </TableRow>
            <TableRow>
                <TableCell>
                    <Paragraph>Green</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>1</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>2</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>3</Paragraph>
                </TableCell>
            </TableRow>
        </TableRowGroup>
    
        <!--  This TableRowGroup hosts a footer row for the table.  -->
        <TableRowGroup Style="{StaticResource FooterTableRowGroupStyle}">
            <TableRow>
                <TableCell>
                    <Paragraph>Totals</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>3</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>6</Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>9</Paragraph>
                </TableCell>
            </TableRow>
        </TableRowGroup>
    </Table>
    

    Whenever you want to define a general Style that will target all of the elements of a certain type, you must not specify a Key for that style. Try removing x:Key from the Style and everything should work properly, like this:

    <Table.Resources>
        <Style TargetType="{x:Type TableRowGroup}">
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="TableCell.BorderThickness" Value="0,1,0,1" />
            <Setter Property="TableCell.BorderBrush" Value="Black" />
        </Style>
    </Table.Resources>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am confused How to use looping for Json response Array in another Array.
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.