vendredi 11 août 2017

Wpf \ MVVM - Where should I put view related properties?

I'm building a WPF application, using MVVM pattern. Let's I have two bars (rectangles) that should change their length according to the ratio between two numbers. For example, if I decide of total length of 100, and one number is 2 and the other is 3, I would like the first bar to be of length 40, and the second one of length 60.

I have these numbers saved as properties in my ViewModel, but my question is what should the bars width attribute be bound to. I could just add two more properties to the ViewModel one for each bar width, but it doesn't feel right, because this is specific for the view.

Any suggestions?

Thanks,

Gal

Aucun commentaire:

Enregistrer un commentaire