Validation on ComboBox Issue

Topics: Conventions
Jan 23 at 7:52 PM
Caliburn.Micro v1.5.2

Setting up a combobox in xaml using the name "StateCombo":
<ComboBox x:Name="StateCombo" Grid.Row="2" Grid.Column="1" Margin="5" />
With the property, "SelectedStateCombo" in the ViewModel:
        public USStateViewModel SelectedStateCombo
            get { return _selectedStateCombo; }
                SetProperty(ref _selectedStateCombo, value);
                NotifyOfPropertyChange(() => Progress);
I am using a ViewModel as a template for each item in the combobox. This works beautifully! The problem I'm having is getting the ErrorTemplate to display on the combobox. I find that I have to add markup to the xaml to get it to work properly.
        <ComboBox x:Name="StateCombo" Grid.Row="2" Grid.Column="1" Margin="5"
                  SelectedValue="{Binding SelectedStateCombo, 
                    UpdateSourceTrigger=PropertyChanged}" />
I haven't checked yet, but I think the ValidatesOnDataErrors setting is skipped in Caliburn.Micro. Is there anything I can do to make this work without the extra xaml markup?
Jan 24 at 1:46 AM
Caliburn.Micro doesn't do validation out of the box that is something you will have to wire up. It's not part of the convention. Check out this answer from the man himself
Jan 24 at 12:29 PM
Thanks, mvermef, but that's not correct. Version 1.5.2 does validate out of the box - at least for the TextBox. I'll try the method mention in the link above to see what happens.
Mar 10 at 4:08 PM
Edited Mar 10 at 4:08 PM
I have just been looking at this issue myself, as I wish to do validation on a ComboBox whilst still using the convention based binding.

Having had a dig through the Caliburn.Micro code, the issue seems to be that the ConfigureSelectedItem routine calls BindingOperations.SetBinding directly rather than calling the SetBinding Action on the ConventionManager which applies all the default validation rules and so forth. I'm not sure if there was a reason for this, perhaps someone with a better understanding of the framework could answer that.

What it does mean is that overriding ApplyValidation has no effect as it is never called.