Grid Cell Background and Converters - Telerik versus Core DataGrid

2 posts, 0 answers
  1. David
    David avatar
    18 posts
    Member since:
    Jan 2011

    Posted 03 Feb 2011 Link to this post

    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 -

    2) Use a Converter and copy loads of style information (same link as above)

    3) Use a CellStyleSelector -

    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?
  2. Vlad
    Vlad avatar
    11100 posts

    Posted 04 Feb 2011 Link to this post

    Hi ,

     Can you post the code you've used with regular DataGrid? 

    Best wishes,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top