This is a migrated thread and some comments may be shown as answers.

How does the RadComboBox handle nulls?

1 Answer 68 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 25 Oct 2013, 07:06 PM
I've discovered something about the out-of-the-box WPF ComboBox. It apparently doesn't handle nulls coming from the database very well. If there's a null in the database, and you do something like this:

<ComboBox x:Name="cmbMajorProbByInterviewer"
          VerticalAlignment="Top"
          ItemsSource="{Binding Source={StaticResource aSICodesSubstanceTypeViewSource2}}"
          DisplayMemberPath="SubstanceDesc"
          SelectedValue="{Binding MajorProblemByInterviewer}"
          SelectedValuePath="SubstanceType"
          Grid.Column="3" />

then it's my experience that if there's a null for the MajorProblemByInterviewer, what the combo box will show is the first item in the items source coming from aSICodesSubstanceTypeViewSource2. That is not what I want.

So I'm wondering, does Telerik's RadComboBox show nothing (i.e.: SelectedIndex == -1) if the value coming from the database is null?

1 Answer, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 30 Oct 2013, 09:49 AM
Hello Rod,

I'm not sure I fully understand what is the desired effect and how the ComboBox selects the first item (I've tried to reproduce this behavior with both RadComboBox and default ComboBox, but I couldn't). Anyway I've prepared a sample project demonstrating my approach - could you give it a try and inform us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ComboBox
Asked by
Rod
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Share this question
or