Bind to WCF Ria Service at Runtime

4 posts, 1 answers
  1. Pim Kerkhof
    Pim Kerkhof avatar
    18 posts
    Member since:
    Oct 2008

    Posted 27 Sep 2010 Link to this post

    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
  2. George
    Admin
    George avatar
    1332 posts

    Posted 30 Sep 2010 Link to this post

    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
  3. DevCraft banner
  4. Pim Kerkhof
    Pim Kerkhof avatar
    18 posts
    Member since:
    Oct 2008

    Posted 07 Oct 2010 Link to this post

    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?
  5. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 12 Oct 2010 Link to this post

    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
Back to Top