I have a WPF application that I am validating ComboBox and TextBox controls using custom Validation classes in XAML.
The following is my ComboBox and it is a required field. I have not found any examples of similar code for validation using RadComboBox.
The following is my ComboBox and it is a required field. I have not found any examples of similar code for validation using RadComboBox.
<
ComboBox
Width
=
"225"
VerticalAlignment
=
"Center"
IsEditable
=
"True"
IsReadOnly
=
"False"
>
<
ComboBox.ItemTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding}"
/>
</
DataTemplate
>
</
ComboBox.ItemTemplate
>
<
ComboBox.Text
>
<
Binding
Path
=
"Name"
UpdateSourceTrigger
=
"LostFocus"
NotifyOnValidationError
=
"True"
NotifyOnSourceUpdated
=
"True"
NotifyOnTargetUpdated
=
"True"
>
<
Binding.ValidationRules
>
<
Validator:RequiredFieldRule
FieldName
=
"Field Name Prompt"
/>
</
Binding.ValidationRules
>
</
Binding
>
</
ComboBox.Text
>
</
ComboBox
>
Here is my Window.Resources code to display the validation error message:
<
Style
TargetType
=
"ComboBox"
>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Center"
/>
<
Style.Triggers
>
<
Trigger
Property
=
"Validation.HasError"
Value
=
"true"
>
<
Setter
Property
=
"ToolTip"
Value="{Binding RelativeSource={x:Static RelativeSource.Self},
Path=(Validation.Errors).CurrentItem.ErrorContent}" />
RequiredFieldRule is a class in my application derived from ValidationRule.
When I replace 'ComboBox' with ' RadComboBox' the Style used to set the ToolTip with the error message does not work.
Any help would be greatly appreciated.