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

Hooking into current theme

3 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
G
Top achievements
Rank 1
G asked on 23 May 2011, 04:29 PM
Hi,

We have a RadGridView that can use any of the supplied Rad Theme's using your mvvm example.

This works fine except for the case where we have had to use a non-standard header. For example:

                <telerikGridView:GridViewDataColumn Width="60" >
                    <telerikGridView:GridViewDataColumn.Header>
                        <CheckBox>
                            <CheckBox.Content>
                                <TextBlock TextWrapping="Wrap" Text="Example Text" />
                            </CheckBox.Content>
                        </CheckBox>
                    </telerikGridView:GridViewDataColumn.Header>
                </telerikGridView:GridViewDataColumn>

We needed a checkbox that wraps it's text in the header.

How do we make the TextBlock use the same theme (Foreground) that the radgridview standard headers are currently using?

Thanks,

G

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 23 May 2011, 06:28 PM
Hello G F,

 

Checkbox control is one of the native Silverlight controls supported by our themes. Since you have set a particular theme on RadGridView just set this theme on this control to achieve the desired result:

<telerikGridView:GridViewDataColumn Width="60" >
                   <telerikGridView:GridViewDataColumn.Header>
                       <CheckBox telerik:StyleManager.Theme="Expression_Dark">
                           <CheckBox.Content>
                               <TextBlock TextWrapping="Wrap" Text="Example Text" />
                           </CheckBox.Content>
                       </CheckBox>
                   </telerikGridView:GridViewDataColumn.Header>
               </telerikGridView:GridViewDataColumn>


You may also reference the particular theme as a StaticResource as shown below:


<CheckBox telerik:StyleManager.Theme="{StaticResource theme}">
....
</CheckBox>

All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
G
Top achievements
Rank 1
answered on 23 May 2011, 06:58 PM
Sorry I mustn't have explained the issue very well.

We need to be able to set the foreground of the checkboxes content (TextBlock) to match the same foreground colour of the RadGridView's header column.

For instance under the Summer theme the foreground for the grid header is White. The Checkbox foreground using the method you mentioned still shows the foreground as black.
0
Vanya Pavlova
Telerik team
answered on 24 May 2011, 08:02 AM
Hello G,

 

In such case you have to manually set the Foreground of the TextBlock based on a theme. 
As you might know we ship our themes as separate projects. You may get the xaml files for all Telerik themes from the Themes folder of your personal installation. From there you may find the default foreground for GridViewHeaderCell in Summer theme within GridViewHeaderCell.xaml and set it to the TextBlock, as shown below:

<telerik:RadGridView  telerik:StyleManager.Theme="Summer" ItemsSource="{Binding Collection}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn  DataMemberBinding="{Binding Property1}">
                    <telerik:GridViewDataColumn.Header>
                        <CheckBox telerik:StyleManager.Theme="Summer">
                            <TextBlock TextWrapping="Wrap" Foreground="White" telerik:StyleManager.BasedOn="Summer" Text="Example Text" />
                        </CheckBox>
                    </telerik:GridViewDataColumn.Header>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 


Best wishes,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
G
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
G
Top achievements
Rank 1
Share this question
or