3

有没有办法在网格的特定单元格上应用着色器效果。

BR

4

1 回答 1

1

您不能在特定的 Grid 单元格上应用着色器效果,但您可以在面板(如 Grid)中添加 Rectangle 或 Border 控件以获得所需的效果。请记住首先添加 Rectangle,或者使用 ZIndex,如下所示,这样您的代码就不会隐藏任何控件。

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Column="0" Grid.Row="1" Panel.ZIndex="0" >
            <Rectangle.Style>
                <Style TargetType="{x:Type Rectangle}">
                    <Setter Property="Fill" Value="Blue"/>
                </Style>
            </Rectangle.Style>
        </Rectangle >
        <TextBox Grid.Column="0" Grid.Row="1" Height="25" Margin="10" Text="Test 123" Panel.ZIndex="1" />
    </Grid>
于 2010-08-14T14:49:24.817 回答