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

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

4 Answers 149 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 13 Sep 2010, 08:31 AM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
Jason Nguyen
Top achievements
Rank 1
answered on 14 Sep 2010, 09:02 PM
Set the EmptyText property to "None"
0
Sagar
Top achievements
Rank 1
answered on 15 Sep 2010, 10:00 AM
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>
0
Accepted
Valeri Hristov
Telerik team
answered on 15 Sep 2010, 01:33 PM
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
0
Sagar
Top achievements
Rank 1
answered on 15 Sep 2010, 02:39 PM
Thanks...
It works fine.
Tags
ComboBox
Asked by
Sagar
Top achievements
Rank 1
Answers by
Jason Nguyen
Top achievements
Rank 1
Sagar
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or