Silverlight 4, MVVM binding: Add Empty line in RadComboBox

2 posts, 1 answers
  1. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 12 Dec 2010 Link to this post

    Hi There,
         I'm using Silver4 with MVVM, no codebehine and directly binding by ViewModel.
    How can I add Empty (blank) line in my radcombobox. So user can select that empty value while they don't have that particular information.
    I bind like following.

     
      <telerik:RadComboBox Grid.Column="1"  Grid.Row="3"
     
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Top"
                                 ItemsSource="{Binding Path=NameSuffixs, Mode=OneWay, NotifyOnValidationError=True,ValidatesOnExceptions=True, ValidatesOnDataErrors=True}"
                                 SelectedValue="{Binding Path=Member.NameSuffixId, Mode=TwoWay}"
                                 DisplayMemberPath="Description"
                                 SelectedValuePath="SuffixId"
    />


    I want to add blank(empty) value line in that binding.
    Thanks.
  2. Answer
    Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 13 Dec 2010 Link to this post

    Hello qwer,

    RadComboBox always displays only the items in its ItemsSource, it cannot add items automatically. You should either add the "empty" item in your ViewModel, or enable the Clear button in RadComboBox:
    http://www.telerik.com/help/silverlight/radcombobox-features-clearselectionbutton.html

    Best wishes,
    Valeri Hristov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
Back to Top