Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Multiple Styles in Markup
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple Styles in Markup

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: Multiple Styles in Markup
    Posted: 18 May 2008 at 11:50pm
Is there a way to add multiple styles to a markup tag?

For example, I have the following markup:


<Page>
    <Page.Resources>
        <Style x:Key="TotalRow">
            <Setter Property="Border.BorderBrush" Value='Black'/>
            <Setter Property="Border.BorderThickness" Value='0,1,0,0'/>
            <Setter Property="TextBlock.FontWeight" Value='Bold'/>
        </Style>
        <Style x:Key="Negative">
            <Setter Property="TextBlock.Foreground" Value='Red'/>
        </Style>
    </Page.Resources>

    <Grid Margin="30">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="50" MaxWidth="200"/>
            <ColumnDefinition MinWidth="50" MaxWidth="150" />
         <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

         <TextBlock Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" FontSize="14">Base Contract</TextBlock>
        <TextBlock Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" FontSize="14" HorizontalAlignment="Right">500.00</TextBlock>
         <TextBlock Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" FontSize="14">Approved Changes</TextBlock>
        <TextBlock  Style="{StaticResource Negative}" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" FontSize="14" HorizontalAlignment="Right">-600.00</TextBlock>
        <Border Style="{StaticResource TotalRow}" Grid.Column="0" Grid.Row="2">
            <TextBlock Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" FontSize="14">Revised Contract</TextBlock>
        </Border>
        <Border Style="{StaticResource TotalRow}" Grid.Column="1" Grid.Row="2">
            <TextBlock Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" FontSize="14" HorizontalAlignment="Right">-100.00</TextBlock>
        </Border>
    </Grid>
</Page>


The -600.00 cell has the Negative style applied (works as expected), but I would like to be able to add the Negative style AND the TotalRow style to the bottom right cell (-100.00). I've tried a few variations like:

 Style="{StaticResource TotalRow, Negative}"
 Style="{StaticResource TotalRow, StaticResource Negative}"
  Style="{StaticResource TotalRow}, {StaticResource Negative}"
 Style="{StaticResource TotalRow}"  Style="{StaticResource Negative}"

With no success. Is this possible, or do I need to create a third style that encapsulates TotalRow and Negative?

Thanks.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2008 at 1:27am
Hi,
 
You can inherit Negative from TotalRow:
 
   <Style x:Key="Negative" BasedOn="{StaticResource TotalRow}">     
     <Setter Property="TextBlock.Foreground" Value='Red'/>    
   </Style>   
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.