简体   繁体   中英

WPF DataGrid | Hiding Row Validation Column

I have a WPF datagrid which has 4 columns, all of those are datagrid template columns. When the grid renders there is a column added automatically on the left, which I understand is used for displaying row validation errors and it's bound by a template RowValidationErrorTemplate.

My question is, I dont want this column to be displayed, and want this to be hidden. How can I set this on my datagrid?

Please note that I'm using .NET 3.5.

My grid style below:

 <Style x:Key="GridStyle" TargetType="{x:Type Controls:DataGrid}">
                <Setter Property="VerticalGridLinesBrush" Value="#7BA0CD"/>
                <Setter Property="HorizontalGridLinesBrush" Value="#7BA0CD"/>
                <Setter Property="AlternatingRowBackground" Value="#D3DFEE"/>
                <Setter Property="CanUserResizeRows" Value="False"/>
                <Setter Property="CanUserReorderColumns" Value="False"/>
                <Setter Property="CanUserResizeColumns" Value="False"/>
                <Setter Property="CanUserSortColumns" Value="False"/>
                <Setter Property="AutoGenerateColumns" Value="False"/>
            </Style>

Found how to do this:

<Setter Property="RowHeaderStyle">
            <Setter.Value>
                <Style TargetType="Primitives:DataGridRowHeader">
                    <Setter Property="Background" Value="Transparent" />
                </Style>
            </Setter.Value>
        </Setter>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM