Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

VB.net 2010 - WPF Datagrid Cell Background Style Issue

$
0
0
So, I am trying to setup a datatrigger for a datagridcell in WPF that shows a red square when the cell contains the word "red". It works but the problem is I am modifying the background and when the row is selected it shows a white box around the square. I want to get rid of the white box and I have been looking for another way of going about what I want but can't figure it out. Below is the code and an example image.

Code:

    <Style x:Key="dgJobsPriority" TargetType="DataGridCell">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Priority}" Value="Red">
                <Setter Property="Background">
                    <Setter.Value>
                        <DrawingBrush Stretch="None">
                            <DrawingBrush.Drawing>
                                <DrawingGroup>
                                    <GeometryDrawing Brush="Red">
                                        <GeometryDrawing.Geometry>
                                            <RectangleGeometry Rect="0,0,16,16" />
                                        </GeometryDrawing.Geometry>
                                    </GeometryDrawing>
                                </DrawingGroup>
                            </DrawingBrush.Drawing>
                        </DrawingBrush>
                    </Setter.Value>
                    </Setter>
            </DataTrigger>
        </Style.Triggers>
        <Setter Property="Foreground" Value="#00000000"/>
    </Style>

Name:  example.jpg
Views: 87
Size:  16.4 KB
Attached Images
 

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>