I'm having trouble choosing what to think about this piece of code:
public SolidColorBrush Brush { get { return IsValid ? _validItemBrush : _invalidItemBrush; } }
This is part of the presentation model in my current project, and as you can imagine, Brush will be tied to some text elements in the user interface to indicate the (un) validity of other parts of the data in an otherwise fairly simple and simple dialog.
Proponents of this piece of code say that since we use WPF, we could also allow some simple WPF constructors in the view model.
Opponents say this violates the Division of Anxiety, as it clearly dictates a style that should be taken care of solely in appearance.
Share your arguments, and if you're unsatisfied with the code above, share your ideas with alternative solutions. (I'm especially interested in what you can say about using DataTemplate s).
Is it possible that there is one solution that can be considered best practice?
Christoffer lette
source share