How does the RadComboBox handle nulls?

2 posts, 0 answers
  1. Rod
    Rod avatar
    71 posts
    Member since:
    Jan 2011

    Posted 25 Oct 2013 Link to this post

    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?
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Oct 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top