null value
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
SIGN IN To post a reply.
5 Replies
MG
Mohanraj Gunasekaran
Syncfusion Team
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.
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxAdv-1129019687
Regards,
Mohanraj G
LS
Leke Salami
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?
SP
Subburaj Pandian Veluchamy
Syncfusion Team
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
Subburaj Pandian V
LS
Leke Salami
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.
MG
Mohanraj Gunasekaran
Syncfusion Team
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
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
LS Leke Salami
- May 16, 2019 01:12 PM UTC
- May 20, 2019 02:35 PM UTC