Binding to SelectedIndex does nothing?

3 posts, 0 answers
  1. Rob Ainscough
    Rob Ainscough avatar
    172 posts
    Member since:
    Jan 2010

    Posted 23 Apr 2013 Link to this post

    I can't seem make binding work on SelectedIndex ... I can make it work on SelectedItem, but if I bind to a property (integer) and change the property, nothing happens to the ComboBox (it's not being updated to reflect the new SelectedIndex).
    <telerik:RadComboBox x:Name="CustomerAcctNameUsageComboBox" Grid.Column="4" Grid.Row="2" Grid.ColumnSpan="2" Style="{StaticResource DCRadComboBoxFill}" ItemsSource="{Binding Path=LookupCustomerAcctNameUsage, Mode=TwoWay}" DisplayMemberPath="CustomerAccountNameUsageDesc" SelectedIndex="{Binding Path=Customer.CustomerAccountNameUsageID, Mode=TwoWay}"/>
  2. Rob Ainscough
    Rob Ainscough avatar
    172 posts
    Member since:
    Jan 2010

    Posted 23 Apr 2013 Link to this post

    UPDATE: I got SelectedIndex working ... for some reason it does NOT like paths to objects properties

    Binding Path=Customer.CustomerAccountNameUsageID

    I setup a property for the parent object that has the main datacontext (in my case UICustomerInfo) and bound to that instead and SelectedIndex worked.  So apparently Path=Object.Property (Customer.CustomerAccountNameUsageID) is not a valid reference even though that reference is a valid property in my datacontext (UICustomerInfo).  Seems odd considering TextBox binding works find with Path=Object.Property so I'm not sure why SelectedIndex can't work this way also??

    If someone can confirm or has more info, please fill me in.

    Thanks, Rob.
  3. DevCraft banner
  4. Konstantina
    Konstantina avatar
    2332 posts

    Posted 26 Apr 2013 Link to this post

    Hello Rob,

    The ComboBox is a selector, so the SelectedIndex can pick up only properties or objects which are in its ItemsSource. Could you please give us some more details about the structure of your data and the DataContext of the ComboBox. If you can send us a sample project illustrating the issue it will be really helpful for resolving the issue in a timely manner.

    Looking forward to your reply.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top