DataGrid AutoGenerateColumns ErrorTemplate

35 Views Asked by At

I'm trying override default DataGridTextBoxColumn ErrorTemplate. I can do this if I manually set DataGridTextBoxColumn but I must using autogeneratecolumns, then I can't style this... Any ideas?

Datagrid default cell ErrorTemplate

Thanks..

1

There are 1 best solutions below

0
Andy On

What you get when you're editing a cell in a datagridtextboxcolumn is a TextBox.

I don't have something set up I can test this with, but it won't really fit in a comment.

I would think if you just apply a style to textbox then that will work.

Put a style in the Datagrid.resources:

<Style TargetType="TextBox">
    <Setter Property="Validation.ErrorTemplate">
        <Setter.Value>
            <ControlTemplate>

And, of course, whatever template you want to use in there.