This is a migrated thread and some comments may be shown as answers.

SelectedValue and SelectedItem

1 Answer 533 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 01 Sep 2016, 12:51 AM
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. 

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 01 Sep 2016, 08:00 AM
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.
Tags
ComboBox
Asked by
Mark
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or