You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in lua mvvm,i can do this,second parameter is a table,third para is a decorator,make a suit style let view show
self:bind("num", {"inventory.current_used", "inventory.capacity"},function(current_used, capacity)
return ("%d/%d"):format(current_used, capacity)
end) -- "5/100"
in c#,I didn't expect any good solution. do you have any good idea? pls tell me ! thanks
The text was updated successfully, but these errors were encountered:
ugui-mvvm is largely modeled after XAML bindings. Back in WPF XAML, we had something to achieve this called a MultiBinding, which aggregated multiple regular Bindings, and then specified an IMultiValueConverter. If ugui-mvvm had something like this, then in your example above, the second parameter would map to the multiple aggregated bindings, and the third parameter would map to the multi-converter.
I think this could be a good approach for ugui-mvvm, but would definitely require some work. I think something like this would make sense:
Factor out some of the core logic in the PropertyBinding class.
Create a MultiPropertyBinding class that has a collection of the factored out stuff from PropertyBinding. Imagine in the inspector having a collection of elements that look similar to what we see in PropertyBinding today, where each element has a binding source, a binding target, and optionally a converter. Additionally, it would have a target property just like PropertyBinding.
Introduce an IMultiValueConverter interface, and have it be a required property on the MultiPropertyBinding. This is the thing that would combine multiple property values into a single output value.
in c#,I didn't expect any good solution. do you have any good idea? pls tell me ! thanks
The text was updated successfully, but these errors were encountered: