A Better Way to Deal with Complex Bindings in XAML

preview_player
Показать описание
Try leveraging your view model for complex bindings!

🕗 Timestamps:
0:00 - Introduction
0:38 - Problem (XAML)
1:21 - Solution (View Models)
4:28 - Summary

➖➖➖➖➖➖➖➖➖➖

© Credits
Рекомендации по теме
Комментарии
Автор

you can also use Switch Case and return something like -1, 0, 1 (or enum, or w/e)
saving you 2 properties to update

TheTigerus
Автор

nice approach and the view looks cleaner, that would be a good video, when muldidatatrigger is worth it, use cases and more tips in your style? i mean "the clever style"

haroldpepete
Автор

Wouldn't it be cleaner to have a number to color converter? Also, is there any way to have a converter to return a tuple? If so, how do I write the xaml to know which tuple value to use?

billymartin
Автор

Is there any way that we could just use one function which set the rate?

mehdi_aghaei_
Автор

I hate converters, I only really use the visibility ones. The people I work with will go out of their way to write really specific converters JUST so they don't have to "pollute" their viewmodel. So we have a library of these wacky converters with really long names. For me, I think its daft. A viewmodel is specifically there to sit between the model and the View to make binding easier! .. so I will have all sorts of stuff on that sucker. Its much easier to code, debug and maintain ... and it performs better.

SirBenJamin_
Автор

Wouldn't it be actually better and cleaner to handle this stuff in code-behind?

hellfim