remove red rectangle around combobox remove red rectangle around combobox wpf wpf

remove red rectangle around combobox


Use this to modify the Validation.ErrorTemplate

<ControlTemplate x:Key="ComboBoxValidationErrorTemplate">    <DockPanel>        <Border BorderBrush="Blue" BorderThickness="4">            <AdornedElementPlaceholder />        </Border>    </DockPanel></ControlTemplate>

And then use it in your ComboBox like

<ComboBox Validation.ErrorTemplate="{StaticResource ComboBoxValidationErrorTemplate}"          ...>

To have no indication of a Validation Error, remove the DockPanel, set Visibility to Collapsed or any other way you like.

Almost forgot, probably the easiest way to remove the "Red Border"

<ComboBox Validation.ErrorTemplate="{x:Null}"          ...>


Add your Combobox, Validation.ErrorTemplate="{x:Null}" ; this code is ignore errors.


The setter in your trigger is setting the Visibility property of an element named "NotValid". That is not defined in the XAML you posted. If there is no element named "NotValid", that is your problem.