Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComboBox incorrect behavior when using Items property #87

Closed
jeromelaban opened this issue Jul 2, 2018 · 4 comments
Closed

ComboBox incorrect behavior when using Items property #87

jeromelaban opened this issue Jul 2, 2018 · 4 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@jeromelaban
Copy link
Member

Using this simple sample, the list is modified at each selection:

<ComboBox>
	<ComboBoxItem>Value 1</ComboBoxItem>
	<ComboBoxItem>Value 2</ComboBoxItem>
	<ComboBoxItem>Value 3</ComboBoxItem>
</ComboBox>

Observed with Uno.UI 1.31.0-dev.94.

@jeromelaban jeromelaban added the kind/bug Something isn't working label Jul 2, 2018
@leboeuf leboeuf self-assigned this Oct 5, 2018
@double28
Copy link

in android,the last selected item dispeared! in ios,no item show!

@leboeuf
Copy link
Contributor

leboeuf commented Oct 11, 2018

Here the items are of type ComboBoxItem, which is a view.
Since views can only have one parent, when ComboBox.UpdateContentPresenter() sets its _contentPresenter.Content to the SelectedItem, the parent of the item becomes that ContentPresenter, which explains why it's not in the dropdown list anymore.

One option would be to implement in Uno the specifics of CarouselPanel that make the dropdown expand around the selected item (if we want the same behavior as UWP).
If you simply want to display strings in your ComboBox I suggest that you use the ItemsSource attribute instead of creating ComboBoxItems manually.

@double28
Copy link

In android,i can define a ItemTemplate of ComboBox,then the behaviour of ComboBox is well.
In IOS, it's not work still! I define a List as the ItemsSource value,it's still show nothing.

@jeromelaban ,do you know How to deal with it? Thank you!

@YGuerin YGuerin self-assigned this Dec 13, 2018
@XiaotianNetlift
Copy link
Contributor

If you need to set the choices in xaml, you can use the primitives literals as a temporary workaround:

<ComboBox>
    <x:String>Red</x:String>
    <x:String>Green</x:String>
    <x:String>Blue</x:String>
</ComboBox>

Using a list for ItemsSource should work on both on ios & android. And, depending on what type of the list you get, you might need to set the DisplayMemberPath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants