-
Notifications
You must be signed in to change notification settings - Fork 81
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
Dropdown Binding automatic updates upon list changes #22
Comments
I have the same exact problem, I need to get a collection of user from a database, but if I change the collection after initialization nothing change (I've tryied the above solutions as well before coming here), is there a way to do it? |
Yes. There's definitely a way, because I figured it out. I'm not at my computer at the moment, but I'll look it up later and write it down. |
Thanks, that would be very kind of you. |
Sorry, I still intend to write it down, but I've suddenly become super busy. I'll try to find some time soon. |
Hi Marijn, thank you for taking the time, but unfortunatly I'm still stuck because the drop down list, as you mention in your initial comment, does not bind to an ObservableList (or at least it doesn't seems to do so). It is also worth mentioning that every other script let me choose the property I'm willing to bind to, but here I have to write down the properties, so I'm not even sure I'm doing it correctly. I think I'll just find a work around using a list. |
Hmm, I had a quick look at the DropDown. It's been a while since I dealt with it. I now notice that it seems a bit convoluted in its setup. It's not that different from a list, in terms of functionality, so I'm pretty sure you'd be better off building your own dropdown control, because then you have better control over things like data binding. Sorry I couldn't be of me help right now. |
In Unity-Weld-Examples, there is one Dropdown example. The example shows how to connect to a simple
string[]
array in the view model, but that only updates the list once upon initialization.I'm having a hard time figuring out how to bind to a list so it will automatically update upon changes in that list. The example uses a simple
string[]
as the type, but I noticed that there are classes likeObservableList
andBoundObservableList
. So I thought I could maybe use those types of lists instead, but no luck. Simply making thestring[]
array property a[Binding]
and doing a call toOnPropertyChanged("MyList")
when the list is changed, seems to have no effect.I looked at the code of DropdownBinding, but couldn't figure out if and how it could be done. I feel like I'm missing something really obvious here, so that's why I thought it's probably best to ask you.
On a side note: I'm using this to link to items from a database, so I'd like to use the ID of those items as the actual value that is used as the Selection value. I'm pretty sure that could be done by using the "Selection View Model To UI Adapter", "Selection UI To View Model Adapter" and "Options Adapter" settings. So hopefully a solution exists where I could solve both of these "problems" at the same time. Thanks.
The text was updated successfully, but these errors were encountered: