Selected value not stored in Data Context

4 posts, 0 answers
  1. Joel Robertson
    Joel Robertson avatar
    1 posts
    Member since:
    Sep 2009

    Posted 04 Nov 2009 Link to this post

    Hi,

    We are using rad combo box for binding the values. We are in the position to bind the values but while saving the values we are not able to get the RadCombo box selected value in the data context by using two way binding. please find the code below
    <telerikInput:RadComboBox Margin="0 2 0 0" x:Name="cbState" DisplayMemberPath="StateName" 
          ItemsSource="{Binding States}" SelectedItem="{Binding StateHome,Mode=TwoWay}"   
           Height="10" IsEditable="False"  Background="White" FontSize="9">  
    </telerikInput:RadComboBox> 
     
    xaml.cs page code:  
     
     
     #region Declaration  
     private readonly DummyData data = new DummyData();  
     #endregion  
     
      public NurseQueue()  
            {             
                InitializeComponent();  
                cbState.DisplayMemberPath = "HomeState";  
            }  
     
     public class DummyData  
        {  
            private readonly List<State> states = new List<State> 
                {  
                      new State {StateName = "Texas"IsDefault = false},  
                      new State {StateName = "New York"IsDefault = false},  
                      new State {StateName = "Alaska"IsDefault = true}  
                        
                };  
     
            public List<State> States  
            {  
                get  
                {  
                    return states;  
                }  
            }  
     
            public State HomeState  
            {  
                get  
                {  
                    return States.First(StateName => StateName.IsDefault);  
                }  
            }  
        }  
        public class State  
        {  
            public string StateName { get; set; }  
            public bool IsDefault { get; set; }  
        }  
     
     

    Thanks
    Sreeraman
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Nov 2009 Link to this post

    Hello Joel,

    I think that the code you've sent contains several errors. I already answered your support ticket and attached a simple application that works properly. Please, let's continue the conversation in just one place.

    Best wishes,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Fábio
    Fábio avatar
    5 posts
    Member since:
    Sep 2010

    Posted 31 Dec 2010 Link to this post

    Hi !
    Could you please show the solution for this post ?

    Best regards,

    Fábio
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 06 Jan 2011 Link to this post

    Hi Fábio,

    Sorry for my late reply.

    I've attached the modified code, please download it and give it a try.

    Best wishes,
    Yana
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top