Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a simple way to set the background cell color for a CustomGrid?

I've got:

<CustomControl:GridControl ShowCustomGridLines="True" Grid.Column="2" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
        <TextBlock Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Name="txbCaption" Text="{Binding Caption}" />
            <CustomControl:GridControl ShowCustomGridLines="True" Grid.Column="2" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="П" HorizontalAlignment="Center" VerticalAlignment="Center" />
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Ф" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Yellow" />
                <TextBlock Grid.Column="2" Grid.Row="1" Text="%" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </CustomControl:GridControl>

I want to set the cell background of a TextBox (where Background="Yellow"). Setting the background for a TextBox doesn't help because I need to set the background color for the whole cell, even if there is no text.

How can this be done?

like image 906
cnd Avatar asked Apr 27 '12 05:04

cnd


1 Answers

You can put some type of panel in that area and set its background color. For example:

<Rectangle Fill="Black" IsHitTestVisible="False" Grid.Column="1" Grid.Row="1"/>
like image 126
Zabavsky Avatar answered Dec 08 '22 00:12

Zabavsky