I was using the core DataGrid which needed the background of a column changed based on a value. No problem - I used a Converter bound to the Background property and returned a Brush depending on the value. Worked great- the cell background changed colour.
I can bind this to ANYTHING on ANY control that uses a Brush (E.g. Background/Foreground etc.) I don't need to add loads of styles to the page and all my logic is in one place - I can reuse the convertor on other xaml pages and types.
Then I bought Telerik and converted all my grids to RadGridViews. The background colour of the cells did not expand fully and it looked terrible, so I started looking into how Telerik advise you to do this.
Turns out there are 3 solutions:
1) Use an attached behaviour - http://blogs.telerik.com/pavelpavlov/posts/09-10-03/adding_additional_power_to_radgridview_for_silverlight_with_attached_behaviors.aspx
2) Use a Converter and copy loads of style information (same link as above)
3) Use a CellStyleSelector - http://www.telerik.com/help/silverlight/gridview-cell-style-selector.html
Option 1: With the Behaviour, I have to target a specific ordinal column. 6 months later someone adds a new column to the grid and you've potentially got a lot of wasted money in support time.
Option 2: Not sure why I have to copy loads of style info - I don't have to do this in the core control?
Option 3: Works fine but not reusable. Now I have styles that define my colours and they reference a certain type (). I can't just reuse it easily on a Label control background or foreground for example. I have to define each colour as a style - a lot of extra XAML.
Trying all these things just because the usual Background ValueConverter does not work has cost me a day in development time and I am not happy with any of your solutions. The core datagrid was working in 10 minutes with a Background ValueConvertor.
Have I missed something obvious? Why is this so easy to do in the core DataGrid and not in RadGridView?
I can bind this to ANYTHING on ANY control that uses a Brush (E.g. Background/Foreground etc.) I don't need to add loads of styles to the page and all my logic is in one place - I can reuse the convertor on other xaml pages and types.
Then I bought Telerik and converted all my grids to RadGridViews. The background colour of the cells did not expand fully and it looked terrible, so I started looking into how Telerik advise you to do this.
Turns out there are 3 solutions:
1) Use an attached behaviour - http://blogs.telerik.com/pavelpavlov/posts/09-10-03/adding_additional_power_to_radgridview_for_silverlight_with_attached_behaviors.aspx
2) Use a Converter and copy loads of style information (same link as above)
3) Use a CellStyleSelector - http://www.telerik.com/help/silverlight/gridview-cell-style-selector.html
Option 1: With the Behaviour, I have to target a specific ordinal column. 6 months later someone adds a new column to the grid and you've potentially got a lot of wasted money in support time.
Option 2: Not sure why I have to copy loads of style info - I don't have to do this in the core control?
Option 3: Works fine but not reusable. Now I have styles that define my colours and they reference a certain type (). I can't just reuse it easily on a Label control background or foreground for example. I have to define each colour as a style - a lot of extra XAML.
Trying all these things just because the usual Background ValueConverter does not work has cost me a day in development time and I am not happy with any of your solutions. The core datagrid was working in 10 minutes with a Background ValueConvertor.
Have I missed something obvious? Why is this so easy to do in the core DataGrid and not in RadGridView?