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

Add "item value" to the items of the ListDialog #383

Closed
KirillBorunov opened this issue Nov 9, 2021 · 1 comment
Closed

Add "item value" to the items of the ListDialog #383

KirillBorunov opened this issue Nov 9, 2021 · 1 comment

Comments

@KirillBorunov
Copy link
Contributor

Can we add an "associated value" to the items of the ListDialog ?

For example when adding the item we will call it as:
dialogInstance.AddItem("Item description", itemValue);

When reading the result we will get the item index as is now:
dialogResult.ListItem; //will return the index of selected item

And for get the selected item value:
dialogResult.ListItemValue; //will return the value we specified on AddItem

The value will be any data you need to process or identify the selected option. For example: you create a dialog "Please select a color:" and the itemValue could store the color. Or maybe you are creating a dialog with a navigation options like "Cars", "Houses", "Go back", then itemValue may store an value from a enum so you can process the selected item in a switch statement. There are a lot of usage examples...

What do you think? Without this I end creating a own lists for each dialog and doing a lookup from my list each time.

@LDami
Copy link
Contributor

LDami commented Mar 7, 2022

It's a good idea, I will try to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants