Print Page | Close Window

ComboBox Validation

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2631
Printed Date: 29-Jul-2026 at 8:30pm


Topic: ComboBox Validation
Posted By: Waahnsinn
Subject: ComboBox Validation
Date Posted: 21-Apr-2011 at 6:25am
Hi!
I've got a WPF Form on which I want to display a ComboBox. The selection of a value of this ComboBox is required so I need to display e.g. a RedBorder for this ComboBox if no value is selected.
The SelectedItem of the ComboBox is bound to the Property of the corresponding Entity.
The Validation is working - I only need a way to display the error...





Replies:
Posted By: robertg
Date Posted: 21-Apr-2011 at 11:09am
Waahnsinn,

Is it a pre-defined verifier, or a customer verifier which is generating the error status that's not being shown by the combobox control?

Could you post some code, so I can see how you're doing this? I can't really tell you what's wrong without being able to see what you're doing.

There are a few differences between DF validation in WPF and either Silverlight or WinForms. You may also want to look at the writeup for this on the DRC: http://drc.ideablade.com/xwiki/bin/view/Documentation/verification-ui#HVerificationwithaWPFUI

-- Robert


Posted By: gregweb
Date Posted: 21-Apr-2011 at 1:34pm
You could try something like this to force the validation to display:
 
public void Window_Loaded(object sender, RoutedEventArgs e)
{
// we manually fire the bindings so we get the validation initially
cboName
.GetBindingExpression(TextBox.TextProperty).UpdateSource();
   

}

 

Greg




Posted By: Waahnsinn
Date Posted: 26-Apr-2011 at 9:42am
Hello!

I've attached a Sample (works with the NorthwindIB Database).

I want the combobox to display an error when there is no category selected in the ComboBox.


uploads/743/WpfApplicationComboBox.zip - uploads/743/WpfApplicationComboBox.zip


Posted By: robertg
Date Posted: 26-Apr-2011 at 10:42am
Thanks for the upload, I'll take a look at your solution.



Print Page | Close Window