【问题标题】:Is there any way to apply shader effect on particular cell of a Grid有没有办法在网格的特定单元格上应用着色器效果
【发布时间】:2010-08-14 22:49:24
【问题描述】:

有什么方法可以在网格的特定单元格上应用着色器效果。

BR

【问题讨论】:

    标签: wpf shader pixel-shader


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 2019-10-14
      • 2021-11-07
      • 2019-12-09
      • 1970-01-01
      • 1970-01-01
      • 2013-07-31
      • 1970-01-01
      • 2018-01-10
      • 1970-01-01
      相关资源
      最近更新 更多