We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

null value

Thread ID:

Created:

Updated:

Platform:

Replies:

144668 May 16,2019 01:12 PM UTC May 20,2019 02:35 PM UTC WPF 5
loading
Tags: ComboBoxAdv
Leke Salami
Asked On May 16, 2019 01:12 PM UTC

The control is used like this in XAML and I can select multiple items and they are displayed. If I click some other cell after editing, it tries to set the SelectedItems collection binding (MappedResultsSiteEntries property here). The setter for this property does not get a valid collection but null value. <syncfusion:ComboBoxAdv x:Name="MappedResultsSiteEntryComboBox" ItemsSource="{Binding DataContext.ResultSiteMappingEntries, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" DisplayMemberPath="Name" SelectedValuePath="Id" SelectedItems="{Binding MappedResultsSiteEntries, Mode=TwoWay}" IsEditable="True" AllowMultiSelect="True" > </syncfusion:ComboBoxAdv> //The implementation property bound to ComboBoxAdv's SelectedItems property private IList<ResultsSiteMappingData> mappedResultsSiteEntries; public IList<ResultsSiteMappingData> MappedResultsSiteEntries { get => mappedResultsSiteEntries; set { 'value' is null here!!! } }
Thanks 


Mohanraj Gunasekaran [Syncfusion]
Replied On May 16, 2019 01:50 PM UTC

Hi Leke, 

Thanks for using Syncfusion product. 

We have tried your reported scenario in mentioned Syncfusion product version 17.1.0.47 using below attached sample. But the sample return the SelectedItems and SelectedItem properly. So, we suspect that this issue may occur based on your customization. So, please provide all the ComboBoxAdv related customization or let us know the below attached sample differ from your customization. It will be helpful for us to provide the solution at the earliest. 


Regards, 
Mohanraj G 
 


Leke Salami
Replied On May 16, 2019 02:38 PM UTC

Does the bound property for SelectedItems need to be ObservableCollection or can it be a different collection type?

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 17, 2019 12:41 PM UTC

Hi Leke, 
  
Thank you for your update. 
  
Yes, the SelectedItems property supports only IEnumerable collections. 
 
Please let us know, if you need any further assistance. 
 
Regards,
Subburaj Pandian V    


Leke Salami
Replied On May 19, 2019 10:48 AM UTC

How can I stop the control from calling Equals on all items?


>    MyApp.exe!MyApp.MyCustomClass.Equals(MyApp.MyCustomClass other) Line 56    C#
     MyApp.exe!MyApp.MyCustomClass.Equals(object obj) Line 48    C#
     mscorlib.dll!object.Equals(object objA, object objB)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemsControl.EqualsEx(object o1, object o2)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.ContainerFromItem.AnonymousMethod__0(object o, System.Windows.DependencyObject d)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.DoLinearSearch(System.Func<object, System.Windows.DependencyObject, bool> match, out object item, out System.Windows.DependencyObject container, out int itemIndex, bool returnLocalIndex)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.ContainerFromItem(object item)    Unknown
     Syncfusion.Shared.Wpf.dll!Syncfusion.Windows.Tools.Controls.ComboBoxAdv.SelectItems()    Unknown
     Syncfusion.Shared.Wpf.dll!Syncfusion.Windows.Tools.Controls.ComboBoxItemAdv.OnApplyTemplate()    Unknown
//This is call stack


After I add items to the ComboBoxAdv ItemsSource bound property the control calls "Equals" on all the items it contains. This is a call stack of such call:  MyApp.exe!MyApp.MyCustomClass.Equals(MyApp.MyCustomClass other) Line 56    C#
     MyApp.exe!MyApp.MyCustomClass.Equals(object obj) Line 48    C#
     mscorlib.dll!object.Equals(object objA, object objB)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemsControl.EqualsEx(object o1, object o2)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.ContainerFromItem.AnonymousMethod__0(object o, System.Windows.DependencyObject d)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.DoLinearSearch(System.Func<object, System.Windows.DependencyObject, bool> match, out object item, out System.Windows.DependencyObject container, out int itemIndex, bool returnLocalIndex)    Unknown
     PresentationFramework.dll!System.Windows.Controls.ItemContainerGenerator.ContainerFromItem(object item)    Unknown
     Syncfusion.Shared.Wpf.dll!Syncfusion.Windows.Tools.Controls.ComboBoxAdv.SelectItems()    Unknown
     Syncfusion.Shared.Wpf.dll!Syncfusion.Windows.Tools.Controls.ComboBoxItemAdv.OnApplyTemplate()    Unknown

I need to avoid this behavior.

Thanks.

Mohanraj Gunasekaran [Syncfusion]
Replied On May 20, 2019 02:35 PM UTC

Hi Leke, 

Thanks for your update. 

By default, Equals method will be called whenever try to iterate the binding collection or check the item using contains method. From you provided stack trach which will be called for SelectedItems collection. So, please let me know about your exact issue which you are facing in Equals method then only we can provide the possibility of alternate solution for your reported scenario. 

Regards, 
Mohanraj G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon