GridViewComboBoxColumn and nulls

2 posts, 0 answers
  1. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 01 Jul 2010 Link to this post

    I have set the ItemsSource of my combobox column to a list of custom objects.  This works fine and I am able to update my object with the selected item from the combobox.  The problem is that my users will need to be able to set this column to null, so I add a null to the list of objects.  I can see the null in the list fine, but whenever I select it, the property of the DataMember SalesRep does NOT get set at all.  I have to select a different item in the list.  I've put a break point on the Property set and it isn't firing at all on null.  Is this a bug, or is there a "better" way?

        <DataTemplate DataType="{x:Type lib:Security.UserInfo}">
                        <MultiBinding StringFormat="{}{0}, {1}">
                            <Binding Path="LastName" />
                            <Binding Path="FirstName" />
    <telerik1:GridViewComboBoxColumn Name="SalesRepColumn" Header="Sales Rep" DataMemberBinding="{Binding SalesRep, ValidatesOnDataErrors=True,ValidatesOnExceptions=True,UpdateSourceTrigger=PropertyChanged}"/>
    CollectionViewSource userInfoSource = this.FindResource("userInfoSource"as CollectionViewSource;
    var ul = UserInfoList.GetUserInfoList().OrderBy(u => u.LastName).ToList();                        
    ul.Insert(0, null);
    userInfoSource.Source = ul;
    SalesRepColumn.ItemsSource = userInfoSource.View;


    public UserInfo SalesRep {
    get { return GetProperty(SalesRepProperty); }
    set { _salesRep = value; }

  2. Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 06 Jul 2010 Link to this post

    Hi David Brenchley,

    After some research I have found that the problem is in the combo box . RadComboBox  does not support  such setup. The same way behaves the Microsoft ComboBox.

    The workarround I may suggest here is to have a special value to substitute the null value in the combo source - something like the "null object pattern".

    Sincerely yours,
    Pavel Pavlov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top