Print Page | Close Window

Markup Grid Row Background

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=10708
Printed Date: 28 April 2024 at 6:15am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Markup Grid Row Background
Posted By: jpbro
Subject: Markup Grid Row Background
Date Posted: 20 May 2008 at 10:42pm
I've been trying to figure out a way to change the background colour of an entire grid row using a trigger for IsMouseOver without success. I have a feeling that this might not be possible (because the RowDefinition doesn't support properties such as Background and Style). I've tried different workarounds using the Border element, but the best I've come up with is the ability to change the Background property for a single cell and not an entire row...

Does anyone know if what I am trying to do is possible with the current state of XAML support? Here's the code I am using to change a cell:


<Page xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
   <Page.Resources>
        <Style x:Key='SummaryRow' TargetType="Border">
                <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.Setters>
                        <Setter Property="Border.Background" Value="#f5f5e0"/>
                    </Trigger.Setters>
                </Trigger>
            </Style.Triggers>
        </Style>
   </Page.Resources>

   <ScrollViewer>
     
        <Grid VerticalAlignment="Center" Margin="14">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition Width="150"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" Grid.Column="0" Style='{StaticResource SummaryRow}'>
                <TextBlock>Base Contract</TextBlock>
            </Border>
            <Border Grid.Row="0" Grid.Column="1" Style='{StaticResource SummaryRow}'>
                <TextBlock HorizontalAlignment="Right">$5,000,000.00</TextBlock>
            </Border>

            <Border Grid.Row="1" Grid.Column="0" Style='{StaticResource SummaryRow}'>
                <TextBlock>Revised Contract</TextBlock>
            </Border>
            <Border Grid.Row="1" Grid.Column="1" Style='{StaticResource SummaryRow}'>
                <TextBlock HorizontalAlignment="Right">$6,000,000.00</TextBlock>
            </Border>
        </Grid>
 

   </ScrollViewer>
</Page>


I'd like to be able to highlight an entire row (text & amount in the example above) when the mouse is over any cell on a grid row.

Thanks for any advice.


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

Language: Visual Basic 6.0 SP6




Replies:
Posted By: Oleg
Date Posted: 21 May 2008 at 1:45am
Hi,
 
sorry, events in ActiveX version of Markup is quite limited - there is no class model now.
 
As workaround instead single Grid you can try StackPanel + Grid in each Row.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net