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

Bind to WCF Ria Service at Runtime

3 Answers 77 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Pim Kerkhof
Top achievements
Rank 1
Pim Kerkhof asked on 27 Sep 2010, 07:56 AM
Hello,
I want to create a combobox control at runtime and bind it to a DomainDataSource.
The control is visible and items are visible, but the selected item is not set.
What am i doing wrong here?

 

 

Binding binding2 = new Binding();

 

 

 

PropertyPath path2 = new PropertyPath("sFieldName");

 

binding2.Path = path2;

binding2.NotifyOnValidationError =

 

true;

 

binding2.ValidatesOnExceptions =

 

true;

 

binding2.TargetNullValue =

 

"";

 

binding2.Mode =

 

BindingMode.TwoWay;

 

binding2.Source = DomainDataSourceName;

combobox.SelectedValuePath =

 

"Tag";

 


With regards,
Pim

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 30 Sep 2010, 07:35 AM
Hello Pim,

I would suggest you to set SelectedValue of RadComboBox. Attached you can find the project I made for you. 
For more information, please refer to the following link - http://www.telerik.com/help/silverlight/radcombobox-features-selection.html

I hope this helps!

All the best,
George
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
Pim Kerkhof
Top achievements
Rank 1
answered on 07 Oct 2010, 12:17 PM
Hello George,

When I put the ComboBox in XAML together with  DomainDataSource.DomainContext it is all working great!
When I leave the DomainDataSource.DomainContext in XAML and generate the Combobox in code behind (in page_loaded) is does not bind for some reason.
Do I need to use the MVVM pattern to get it working?
0
Accepted
George
Telerik team
answered on 12 Oct 2010, 03:17 PM
Hello Pim,

Yes, I would suggest you to use MVVM pattern in order to accomplish it, or set it in the constructor, after InitializeComponent(), not in the Loaded event handler.

Greetings,
George
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
Tags
ComboBox
Asked by
Pim Kerkhof
Top achievements
Rank 1
Answers by
George
Telerik team
Pim Kerkhof
Top achievements
Rank 1
Share this question
or