[SOLVED] ComboBox

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

[SOLVED] ComboBox

Postby Sesztak » Sat Jul 16, 2016 3:59 am

Dear Js-Support,

We have lot of problems with your ComboBox (in Simulator and in Browser as well):

Background info: we have read all the related info at this forum as :
-no datatemplate possible, only one property by setting DisplayMemberPath : we are not happy, but acceptable.
-comboBox.ItemsSource = new List<Type> (Object) trick : does not work for 2dn time.

Our problems (your bug):

1./ when we try to refresh with ItemsSource several times with same items:
the first time : ok, as expected.
but 2nd/3rd/more times: the items in the ComboBox list gots some random duplicates and triplicates, and so on...

We tried everything, e.g. comboBox.ItemsSource = null; to clear items before refreshing with new ones: nothing works !!

2./ when we try fill comboBox.Items manually (a for cycle with comboBox.Items.Add(_someList[i]) ) : it works as expected, BUT:

not possible to clear all element (before next time we try to add ) !!

if comboBox.Items.Count != 0 and we try to clear the list:
comboBox.Items.Clear();


WE HAVE GOT HUGE EXCEPTION:
exc = {"Index must be within the bounds of the List.\r\nParameter name: index"}
StackTrace = " at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)\r\n at System.Collections.Generic.List`1.Insert(Int32 index, T item)\r\n at Windows.UI.Xaml.Controls.ItemsControl.ManageCollectionChanged(...

So, let us summarize where we are actually ?
-.ItemsSource = new List<Type> (Object) : does not work to refresh (works at very first time, but not after: items got random mixed/jagged somehow only some items duplicated/triplicated)!,

-.Items fill manually: works, but not possible to Clear() as we have got exception.

-any other solution does not work as well ( .ItemsSource = null, or fill with .ItemsSource = new List<Type> (Object) and Clear manually).

So, please show us at least one working solution how to refresh the items in comboBox ???

Should we remove every items manually ??, like: .Items.RemoveAt(0) ??

Thanks in advance,
Br,
Péter

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: ComboBox

Postby xidea » Wed Jul 20, 2016 1:57 pm

Same trouble with ItemsControl, 8.4 beta.

After one day of attempts, every combination of actions gives the same result: when trying to set to null the ItemsSource the first time it works, the second time it throw a Key Not Found exception, at the item removal stage of the internal code.
But a second ItemsControls binded to a list of a different type seems to work (!). Both types are custom classes, not so different.
So it's impossible to clear the list and add new items.

Cattura.PNG
Cattura.PNG (32.16 KiB) Viewed 12619 times


Please help.

Flavio

Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Re: ComboBox

Postby Sesztak » Thu Jul 21, 2016 12:52 am

Dear xidea,

just a kind help from us:
the absolute manual workaround to refresh the items of combobox:

int NumberOfItemsToRemove = comboBox.Items.Count;
for (int i = 0; i < NumberOfItemsToRemove; i++) { comboBox.Items.RemoveAt(0); }

for (int i = 0; i < response.SomeListToAdd.Count(); i++) { comboBox.Items.Add(response.SomeListToAdd[i]); }

comboBox.SelectedIndex = -1; // TODO: Bug -it is not working !!

Let me ephasize/highlight: this is not the correct way what we normally used to do it, it is just an 'old fashion workaround' because of the bug of CSHTML5.

As I think the expected behaviour MUST be in the Future : work with .ItemsSource :
to fill: comboBox.ItemsSource = SomeCollection; // System.Collections.IEnumerable
to clear: comboBox.ItemsSource = null;

Dear xidea, Is the above mentioned workaroud (manual remove and add) is working at your side ?

Best Regards,
Péter

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: ComboBox

Postby xidea » Thu Jul 21, 2016 7:31 am

Péter,

I appreciate your help. Unfurtunately my issue is with the ItemsControls (I think the combo shares same kind of bug) and when I try to modify the Items collection an error comes to say that is not possible to modify the collection when the ItemsSource is in use. So to remove items I must null the ItemsSource and it raises the error I've reported the second time I try to set it to null.

It seems that for ItemsControl there is no workaround, so I expect a fix in short time.

Sesztak wrote:Dear xidea,

As I think the expected behaviour MUST be in the Future : work with .ItemsSource :
to fill: comboBox.ItemsSource = SomeCollection; // System.Collections.IEnumerable
to clear: comboBox.ItemsSource = null;



Yes, that's the way.


Thanks,

Flavio.

Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Re: ComboBox

Postby Sesztak » Thu Jul 21, 2016 7:37 am

Hi Flavio,

I expect a bug fix too ... :)

back to my temporary workaround: "ItemsSource is in use" : yes, I know.

Workaround: not to use ItemsSource = .. !! never !
fill items manually (e.g. with .Items.Add(..) )

Do you understand or should I miss something ? (and I'm who do not understand you)

Regards,
Péter

xidea
Posts: 33
Joined: Thu Jun 30, 2016 7:04 pm

Re: ComboBox

Postby xidea » Thu Jul 21, 2016 10:34 am

OK, I understand, if no fixes in short I'll try this way. But I don't understand your sarcasm, I never thought you don't understand me. Sorry for poor English, anyway.

Thanks,

Flavio

Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Re: ComboBox

Postby Sesztak » Thu Jul 21, 2016 10:49 am

Dear Flavio,
You are like my wife !! :))) :
You completely misunderstand my intention: you should absolutely 100% sure I have no 'sarcasm' in any way !!!

The opposite is the truth: all I wanted to know, simply : m'I miss something from your side ?
(means: I wanted to be sure: Do I understand you correctly? -that's all.)

I feel much more: we are in the same boat.

Have nice day and night !
Péter
from Budapest !

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: ComboBox

Postby JS-Support @Userware » Sun Jul 24, 2016 11:49 am

Thanks for reporting this issue.

We have been able to reproduce it.

The fix didn't make it for Beta 9.0, but it will be available in Beta 9.1 soon after.

Thank you.
Regards,
JS-Support

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: ComboBox

Postby JS-Support @Userware » Mon Aug 29, 2016 6:43 am

We completely revamped the handling of ItemsSource and the ComboBox in Beta 9.1.

The issue should now be fixed.

You can download it from:

http://forums.cshtml5.com/viewforum.php?f=6

Thank you.
Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 35 guests

 

 

cron