Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Datagrid RowHeader Template issue

$
0
0

Hi,

I have datagrid with RowHeader style like this: If I don't use Template here then it shows me error sign ("!") like this if any row has an error.

<Style TargetType="{x:Type DataGridRowHeader}">  

<Setter Property="Foreground" Value="{DynamicResource ContrastWhiteBrush}" />
                <Setter Property="Background" Value="{DynamicResource ContentToGreyedOutBrush}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ContentNormalBrush}"></Setter>
                <Setter Property="BorderThickness" Value="0,0,1,1"></Setter>             
</Setter>  

</Style>  

 

But If I apply template to that then it does not display this ("!") sign even if row as an error

<Style TargetType="{x:Type DataGridRowHeader}">  

<Setter Property="Template" Value="{StaticResource RowHeaderControlTemplate}" /> 

</Style>  

I want to show both error icon as well as want to apply template

This is my template:

 <ControlTemplate TargetType="{x:Type DataGridRowHeader}" x:Key="RowHeaderControlTemplateNoMouseOver"> 
            <Grid Background="{TemplateBinding Background}" x:Name="dgRowHeader">
                <Border x:Name="border"  Grid.ColumnSpan="1" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                    <Rectangle HorizontalAlignment="Stretch"  Margin="3,3,3,3" RadiusX="5" RadiusY="5" x:Name="PART_RectangleRowNoMouseOver" VerticalAlignment="Top" Fill="{DynamicResource ContentOutofFocusBrush}" Height="20"></Rectangle>
                </Border>
                <ContentPresenter x:Name="content"  HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,6,0,0" Content="{TemplateBinding Content}" Height="20" />
            </Grid>
    </ControlTemplate>

How would i do that ?

Please help Thanks

Dee



Viewing all articles
Browse latest Browse all 18858

Trending Articles



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