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

DisplayMemberPath issue - values not displaying

4 Answers 572 Views
MultiColumnComboBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 10 Mar 2020, 10:30 AM

We currently having issues using the RadMultiColumnComboBox when we change property on the view model which we are binding to.  

1.  We have multiple items with properties and one property is connected to the ComboBox.

2. We select one item in the view and the connected property is displayed in the ComboBox correctly.

3. We select a different item with the same value in the connected property, but the ComboBox does not display any text (null text).

4. Selecting another item with different value in the connected property results in displaying text again in the ComboBox.

 

For example items could be employees with a display name (DisplayName) property. We have a list of employees populated as item source provider. 

The DisplayMemberPath in the ComboBox is set to the DisplayName property.

The SelectedItem property is set to the employee. We also have three more ComboBoxes on the same page that behave correctly (just binding to different properties) and cause no issue.

 

Any idea what could go wrong?

 

Regards, Martin

4 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Mar 2020, 12:33 PM

Hello Martin,

Thank you for the provided details.

To avoid any misunderstanding in the set-up, is it possible to isolate this behavior in a standalone project. This way, I can have a better look and debug it on my side.

I am looking forward to your reply.

Regards,
Dinko
Progress Telerik

Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Martin
Top achievements
Rank 1
answered on 01 Apr 2020, 07:51 AM

Hello Dinko!

Thanks for your reply! Unfortunately we were not able to reproduce the behaviour within an small sample project. But we found the cause in our project. Basically it all comes down to connecting a model object to the control that implements the IEquatable interface an provides an implementation for Equals() and GetHashCode(). That somehow seems to interfere with the binding and creates the behaviour i described in my initial posting. As soon as we remove the interface implementation from the model class, the binding and the control works as expected. Can it be that the RadMultiColumnComboBox somehow relies on a default implementation of the IEquatable? (We use the MVVM light Toolkit, if that's somehow relevant?) 

 

Regards, Martin

0
Dinko | Tech Support Engineer
Telerik team
answered on 03 Apr 2020, 11:06 AM

Hi Martin,

Thank you for the provided additional information. 

Without reproducing it is hard to say what is the exact reason. My opinion is that custom implementation of the IEquatable shouldn't interfere in the visualization of the control. Still, I have tried to reproduce this behavior in a standalone project on my side but everything is working as expected. You can find the project attached to this reply. I also think that using the MVVM light toolkit shouldn't be related in any way.

Can you take a look at the attached project and check what I could be missing from your implementation?

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Martin
Top achievements
Rank 1
answered on 06 Apr 2020, 08:48 AM

Hi Dinko!

 

Thank you for providing the sample project. We will take a look at it to see if we somehow can reproduce it on a smaller scale.

 

Regards, Martin

Tags
MultiColumnComboBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Martin
Top achievements
Rank 1
Share this question
or