Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
SeclectionChanged event fires too many times in certain situations
posted

According to your documentation the correct event to use to detect a change in value from the combobox is SelectionChanged.

This event is firing twice when the combobox is configured in the following way (irrelevant properties removed)

<ig:XamComboEditor Name="TestCombo" ItemsSource="{Binding DeviceTagValues}" DisplayMemberPath="Id" SelectedItem="{Binding SelectedDeviceTagValue, Mode=TwoWay}" AutoComplete="True" IsEditable="True" CustomValueEnteredAction="Allow">

When you have selected a different item in the list that has the same DisplayMemberPath value as the currently selected item the setter for the bound SelectedItem is fired twice (the SelectionChanged event is fired twice also)

Once to set it to the new value and then again setting it back to the previously selected value.

I believe this is a bug.

I have attached a solution that reproduces the issue.  I am currently using v11.2.

I have been able to work around this issue in my solution somewhat by using a command that is invoked on the PropertyChanged event but this has a different bug where it doesn't select the new value.  I believe this is because the DisplayMemberPath values are the same ,so a selection change is not detected.

What am I meant to do?  Is it possible to separate what is dispalyed in the combobox when an item is selected from the DisplayMemberPath property?  I.e  Display A44 in the combobox where the value for DisplayMemberPath is A44,MG43.

This way the DisplayMemberPath values are different thus a selection change would be detected but the display in the combobox can be styled as needed.

To reproduce the issue in the sample I have attached complete the following steps

  • Set a breakpoint in the TestCombo_SelectionChanged event handler in MainPage.xaml.cs or in the setter of SelectedDeviceTagValue on the view model in ViewModel.cs or both
  • Select the first A56 item in the combobox.  Note that the breakpoints are only hit once
  • Select the next A56 item in the combobox.  Note that the breakpoints are hit twice and that it sets it two the new value in the first setter and the back to the old value in the subsequent setter

Please get back to me ASAP regarding possible solutions.

 

 

NewBug.zip
Parents
No Data
Reply
  • 6759
    Offline posted

    Hi,

    this is bug for sure. I have submitted an internal bug item  #100051. I've also created a support case on your behalf so you could track the progress on it. The support case id is CAS-82558-NP9NZ6.

    Thanks for reporting the issue in such a clear and detailed manner. If you need any further assistance on this matter you could contact the Developer Support or write here as well.

    Regards,

Children