SelectedValue and SelectedItem

2 posts, 0 answers
  1. Mark
    Mark avatar
    61 posts
    Member since:
    Dec 2010

    Posted 31 Aug 2016 Link to this post

    I have a Telerik RadCombobox where I need to react to the change of selected item and store the selected value.
    telerik:RadComboBox ItemsSource="{Binding CurrencyList}"<br>  DisplayMemberPath="Currency"<br>  SelectedValuePath="CurrencyID"<br>  SelectedValue="{Binding SelectedIssuance.IssuanceCurrencyID, Mode=TwoWay}"<br>  IsSynchronizedWithCurrentItem="True"<br>  SelectedItem="{Binding SelectedCurrency,Mode=OneWayToSource}"

    This works the first time I access the view, however subsequent accesses on the same or another record the displayed value is always the first record in the CurrencyList

    Any suggestions on how to fix this issue?

    One idea is to get the changed value in the VM from the Model by subscribing to the OPC event and remove the SelectedItem binding. 
  2. Kalin
    Kalin avatar
    1357 posts

    Posted 01 Sep 2016 Link to this post

    Hello Mark,

    Looks like you are using one property in the ViewModel for the SelectedValue and SelectedItem, so it doesn't work as expected. You would need two separate properties in order to achieve the desired - please check the attached sample project. For more details regarding the SelectedValue and SelectedValuePath, you could check the following article:

    Hope this helps.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top