This is a migrated thread and some comments may be shown as answers.

GridViewCell CellStyle background not changing

9 Answers 330 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 14 Aug 2009, 11:16 AM
I am trying to change the background colour of certain cells based on the value of the data.

Here are the converter and style resources i use. This is all based on the example given in the documentation and on some other forum posts.
    <UserControl.Resources> 
        <cur:AssumedLevelToColour x:Key="convAssumedLevel"/> 
        <Style x:Key="assumedLevelStyle" TargetType="{x:Type telerik:GridViewCell}"
            <Setter Property="Background"
                <Setter.Value> 
                    <SolidColorBrush Color="{Binding Path=AssumedLevel, Converter={StaticResource convAssumedLevel}}" /> 
                </Setter.Value> 
            </Setter> 
        </Style> 
    </UserControl.Resources> 
AssumedLevelToColour is a simple float to colour converter that returns red, orange or green depending on the level.

And here is the grid view code including the relevant column.
       <telerik:RadGridView Margin="6,6,6,6" MaxHeight="1000" Name="lstDefenders" Grid.ColumnSpan="3" SelectionChanged="lstDefenders_SelectionChanged"  telerik:StyleManager.Theme="Vista" IsReadOnly="True" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" ColumnsWidthMode="Auto" MultipleSelect="True" > 
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn HeaderText="Manufacturer" DataMemberBinding="{Binding Manufacturer, Mode=OneWay}" /> 
                <telerik:GridViewDataColumn HeaderText="Product" DataMemberBinding="{Binding Name, Mode=OneWay}" /> 
                <telerik:GridViewDataColumn CellStyle="{StaticResource assumedLevelStyle}" HeaderText="Assumed Level" DataMemberBinding="{Binding AssumedLevel, Mode=OneWay}" /> 
                <telerik:GridViewDataColumn HeaderText="Type" DataMemberBinding="{Binding Type, Mode=OneWay}" /> 
                <telerik:GridViewDataColumn HeaderText="Approval" DataMemberBinding="{Binding Approval, Mode=OneWay}" /> 
                <telerik:GridViewDataColumn HeaderText="Notes" DataMemberBinding="{Binding Notes, Mode=OneWay}" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
The list is populated using the ItemsSource property.

The converter is being called correctly but the background colour doesnt change.
I have only noticed this in Q2 SP1, was working in Q1, not sure about Q2.

Thanks,
Martin

9 Answers, 1 is accepted

Sort by
0
Missing User
answered on 14 Aug 2009, 11:31 AM
Hello Martin,

This is a known issue with our SP1 and we are currently investigating it. We will try to fix it as soon as possible. Once we fix the issue we will included in one of our next latest internal builds.

Sorry for the inconvenience caused.

All the best,
Anastasia
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Erez
Top achievements
Rank 1
answered on 19 Aug 2009, 12:53 PM
Hello,

I have a similar need.
It seems that "Foreground" is not working also.

Can you please verify it ?

Thanks,

Erez
0
Erez
Top achievements
Rank 1
answered on 19 Aug 2009, 12:59 PM
I am using 2009Q2.

Erez

0
Missing User
answered on 19 Aug 2009, 01:27 PM
Hello Erez,

The Foreground issue was fixed in our service pack. But unfortunately as I mentioned in my previous reply Backround still cannot be set within the CellStyle.  Once the fix is ready it will be included in one of our next latest internal builds.

Sincerely yours,
Anastasia
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Erez
Top achievements
Rank 1
answered on 19 Aug 2009, 02:32 PM
Hello,

From where would I be able to receive the internal build ?

Thanks,

Erez

0
Missing User
answered on 19 Aug 2009, 02:43 PM
Hello Erez,

You can find our latest internal builds here and our Q2 2009 SP1 here.

All the best,
Anastasia
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Erez
Top achievements
Rank 1
answered on 20 Aug 2009, 12:26 PM
Hello,

I have downloaded the build (DLL only) BIN35:
RadControls_for_WPF_2009_2_0813_TRIAL_hotfix.zip
 
and tested the Foreground.

It works, however there is a slight bug with the Foreground:

The data trigger is not aware to a change I make in a cell unless I exit the row the cell is in.
If, for example, I click on another cell on the same row, the foreground stays the same.

This seems to be related to the Foreground, because the FontWeight property DOES change when I click on another cell in
the same row.


<telerik:GridViewDataColumn HeaderText="Size" DataMemberBinding="{Binding Size}">
                    <telerik:GridViewDataColumn.CellStyle>
                        <Style TargetType="telerik:GridViewCell">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=Size2, Converter={StaticResource MySizeToErrorConverter}}" Value="True">
                                    <Setter Property="FontWeight" Value="Bold" />
                                    <Setter Property="Foreground" Value="Red" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </telerik:GridViewDataColumn.CellStyle>
                </telerik:GridViewDataColumn>

Thanks,

Erez
0
Rossen Hristov
Telerik team
answered on 28 Aug 2009, 07:25 AM
Hello Erez,

We will need some more time to investigate this. We will let you know when we have more info on the subject. Please, excuse us for the late reply.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kalin Milanov
Telerik team
answered on 04 Sep 2009, 06:59 AM
Hello Erez,

Thank you for your feedback. Indeed what you are sharing with us is a bug and it has been logged in our backlog. Q2 SP1 came with a completely new styling mechanism mainly due to Silverlight 3 and inevitably it affected some visuals. we are working diligently on resolving all issues we find as well as the ones reported by the community.

I apologize for the inconvenience and the time it took for this reply.

Sincerely yours,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Martin
Top achievements
Rank 2
Answers by
Missing User
Erez
Top achievements
Rank 1
Rossen Hristov
Telerik team
Kalin Milanov
Telerik team
Share this question
or