SelectedValue and SelectedItem

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

    Posted 31 Aug 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
    Admin
    Kalin avatar
    1207 posts

    Posted 01 Sep 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:
    http://docs.telerik.com/devtools/wpf/controls/radcombobox/features/selection#using-selectedvalue-and-selectedvaluepath

    Hope this helps.

    Regards,
    Kalin
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top