Binding data to RadComboBox by domain data source as well as through code behind

5 posts, 2 answers
  1. Sagar
    Sagar avatar
    17 posts
    Member since:
    Sep 2010

    Posted 13 Sep 2010 Link to this post

    Can we attach domain data source (ria control) and also add items through code behind to one rad combo box in Silverlight?
    I've attached domain data source to radcombobox in xaml & want to add one value i.e. "None" to radcombobox which is not in domain source.Is it possible ?
    I tried it in domainsource_loadeddata event
    radcombobox1.items.add("None");
    but it is not added.I debug and found that radcombobox1.items.IsReadOnly property is true.I also tried to change it to false but it gives error.
    Can anybody help me?
    I need it in my project.
  2. Answer
    Jason Nguyen
    Jason Nguyen avatar
    14 posts
    Member since:
    May 2010

    Posted 14 Sep 2010 Link to this post

    Set the EmptyText property to "None"
  3. DevCraft banner
  4. Sagar
    Sagar avatar
    17 posts
    Member since:
    Sep 2010

    Posted 15 Sep 2010 Link to this post

    Thanks,I get None on Combo Box.
    but I bind Selected text of combo box to textblock,when no record is selected from combo box i want to show "None" on textblock too.

    <TextBlock x:Name="TextBlock1" Text="{Binding Text, ElementName=RadComboBox1}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                                        <telerik:RadComboBox x:Name="RadComboBox1"
                                            Grid.Row="1"
                                            Margin="5"
                                            Width="275"
                                            EmptyText="*None"
                                            VerticalAlignment="Center"
                                            ItemsSource="{Binding Data, ElementName=DomainDataSource1}"
                                            DisplayMemberPath="Desc"
                                            SelectedValuePath="ID"
                                            SelectedValue="{Binding TypeID, Mode=TwoWay}" HorizontalAlignment="Left">
                                        </telerik:RadComboBox>
  5. Answer
    Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 15 Sep 2010 Link to this post

    Hi Sagar,

    You could bind the TextBlock's Text property through a converter, which will return "None" when the provided value is null or string.Empty.

    Sincerely yours,
    Valeri Hristov
    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
  6. Sagar
    Sagar avatar
    17 posts
    Member since:
    Sep 2010

    Posted 15 Sep 2010 Link to this post

    Thanks...
    It works fine.
Back to Top
DevCraft banner