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

Combobox Binding

1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Javor asked on 29 Aug 2018, 01:05 PM

I have following code 

when I clicked something form combobox and have error and return value to old value in that case the selected item in combobox is the last selected 

01.public class MyClass
03.    public int ForeignId
04.    {
05.        get
06.        {
07.            return MyObject.ForeignId;
08.        }
10.        set
11.        {
12.            int oldValue = MyObject.ForeignId;
14.            try
15.            {
16.                MyObject.No = Helper.Help(value)
17.            }
18.            catch
19.            {
20.                MyObject.ForeignId = oldValue;
21.            }
23.            OnPropertyChanged(() => ForeignId);
24.        }
25.    }
27.    public MyObject MyObject{ getset; }


<telerik:RadComboBox ItemsSource="{Binding ItemList}" DisplayMemberPath="Name" SelectedValuePath="ForeignId"
                     SelectedValue="{Binding ForeignId, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}" />


1 Answer, 1 is accepted

Sort by
Vladimir Stoyanov
Telerik team
answered on 03 Sep 2018, 09:35 AM
Hello Javor,

Thank you for the provided code. 

I tried to reproduce the described scenario on my side however I was not able to do so. This is why I am attaching the sample project that I used for testing. Please, check it out and see how it differs from the setup at your side. Should you need any further assistance, may I ask you to let me know what you are doing differently or share some steps which I can follow so that I can reproduce the scenario and investigate it further?

I am looking forward to your reply.

Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question