Bind a SolidColorBrush to a DataGridCell/CellStyle from a ViewModel?

Go the converter route. In addition I would title the property something to the effect of Department and not tie color to it as it makes it more tightly coupled to the UI. While the department may be Accounting coupling that to a color implies you are certain that it will be represented via a Color whereas down stream it may be represented in some other visual fashion.

You could also create the styles ahead of time and then simply select one and apply it via the converter, versus trying to create them in the code behind.

Go the converter route. In addition I would title the property something to the effect of Department and not tie color to it as it makes it more tightly coupled to the UI. While the department may be Accounting coupling that to a color implies you are certain that it will be represented via a Color, whereas down stream it may be represented in some other visual fashion.

You could also create the styles ahead of time and then simply select one and apply it via the converter, versus trying to create them in the code behind.

Department is already reserved for the Department`s name... Maybe I should explain: I have organizer/calendar with a DataGrid where each Department has its own Backcolor. So naming it DepartmentBackColor is not wrong, why should it be wrong? To your suggestion: When I create the styles then I create them in code-behind... I assume this as you have not written I should create them in the ViewMode.

– Pascal Oct 18 '10 at 20:32 My belief is that you should not push UI type references into the ViewModel. Color is a direct relationship to the UI. Allow the UI to determine what to do with the department type, which may happen to be color in this instance.

Create the Styles as reusable styles in a ResourceDictionary which can then be referenced in your code behind (converter). – Aaron McIver Oct 18 '10 at 21:38 if I would have a Model with a property called DepartmentColor, I would understand your argumentation. But its the ViewModel`s Property DepartmentColor and the ViewModel is bound directly to the View.

So why not Department"Color"? I find it totally okish. – Pascal Oct 22 '10 at 19:03.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions