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
35
Possible defect in InfragisticsSL4.Controls.Editors.XamComboEditor.v11.2
posted

Hello, I'm having an issue with XamComboEditor whereby occasionally the function

ItemPanelBase.RenderItem<T2, TControl2>(T2 comboEditorItem, Size availableSize) in your code is called with a null comboEditorItem causing a crash;

I've looked a bit into it and it seems like the function MeasureOverride is responsible for passing the null value in;

The null value is passed in via this line in your ItemsPanelBase.RenderOverride function

Size firstItemSize = this.RenderItem(firstItem, availableSize);  //firstItem is null

Looks like this is something to do with the management of the VisibleItems list

I can reproduce this issue by putting a variety of different kinds of items into the combobox and clicking on the drop-down arrow repeatedly until eventually the render function crashes;

Oh, also as a side note you have some truly, truly, awful code which has caused me no ends of headaches in the DataManagerBase.ResolveIndexForRecord function

In this buggy heap of garbage code  if it's bound to a list will use equality comparer and if its bound to something else, like an array or IEnumerable, will scan through it using reference ==

This means that the behavior of your combobox can change radically whether I bind to an IList or an IEnumerable, very not good.

        public int ResolveIndexForRecord(object data)

        {

            if (this._sortedFilterDataSource == null)

            {

                if (this.IListData != null)

                    return this.IListData.IndexOf(data);

                else

                {

                    int index = -1;

                    foreach (object current in this.OriginalDataSource)

                    {

                        index++;

                        if (current == data)

                            return index;

                    }

                }

            }

            else

            {

                return this._sortedFilterDataSource.IndexOf(data);

            }

 

            return -1;

        }

 

 

 

IndexOf
This method determines equality using the default equality comparer EqualityComparer<T>.Default for T, the type of values in the list.

 

 

==

By default uses reference compare

 
These two things are obviously a lot different, you shouldn't be switching between them.

 

Parents
  • 138253
    Offline posted

    Hello Matthew,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

Reply Children
No Data