views:

234

answers:

0

Hello, I have a ComboBox with IsEditable="true". I'm trying to set an error template on the ComboBox. This is my error template that I have in my Window.Resources

       <ControlTemplate x:Key="error">
            <Border BorderBrush="Red" BorderThickness="1">
                <AdornedElementPlaceholder x:Name="adorner" />
            </Border>
        </ControlTemplate>

and then I assign it like this

<ComboBox Grid.Row="0" Grid.Column="1"
          Name="serverTextBox"
          IsEditable="True" 
          Text="{Binding Database, ValidatesOnDataErrors=True}"
          Validation.ErrorTemplate="{StaticResource error}" />

Everything about this looks fine, but if I type in something that breaks the validation nothing happens on the ComboBox. I've traced the code to make sure my validations are getting called and they are. I'm guessing it has to do with the fact that the ComboBox ControlTemplate has an actual TextBox when IsEditable="True" and the validation happens on the text box, but the ComboBox isn't receiving the error message.

Does any one have a fix for applying an ErrorTemplate to a ComboBox with IsEditable="True" ?

Thanks, Raul