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

How to change font size in a GridViewComboBoxColumn

9 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tobias
Top achievements
Rank 1
Tobias asked on 26 Aug 2013, 01:29 PM
Hi,
I have to change the font size of my whole grid.
No problem, I use the FontSize style parameter. But now, I embbeded some GridViewComboBoxColumns which don't have a font size member. That's why Visual Studio will show up an exception.

How can I change the fontsize of a GridViewComboBoxColumn? Please don't say via template manipulatiion. :)

I tried different target types like 'gridviewrowbase' 'gridviewcellbase', etc. nothing worked.

Thanks for your help!

Regards,
- Tobias

9 Answers, 1 is accepted

Sort by
0
Tobias
Top achievements
Rank 1
answered on 26 Aug 2013, 02:56 PM
I tried the style:
<Style x:Key="ComboBoxCellStyle" TargetType="telerik:GridViewCell">
    <Setter Property="FontSize" Value="10" />
</Style>
 
<Style TargetType="telerik:GridViewComboBoxColumn">
    <Setter Property="CellStyle" Value="{StaticResource ComboBoxCellStyle}" />
</Style>

... without any sucess.

Regards,
- Tobias
0
Tobias
Top achievements
Rank 1
answered on 27 Aug 2013, 10:13 AM
Hi,
I found a solution!
I altered the theme source:

<Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <!-- Removed the line:
                             FontSize="{telerik:Windows8Resource ResourceKey=FontSize}"
                             to achieve an inherit font size
                        -->
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding Caption}"           
                                   FontFamily="{telerik:Windows8Resource ResourceKey=FontFamily}" />
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Text="{Binding FormattedValue}"
                                   FontFamily="{telerik:Windows8Resource ResourceKey=FontFamily}" />
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>

Regards,
- Tobias
0
Tobias
Top achievements
Rank 1
answered on 06 Sep 2013, 08:45 AM
My solution hat to many side effects. :(
Does anybody know an other trick?

Thanks!
0
Yoan
Telerik team
answered on 06 Sep 2013, 03:55 PM
Hi Tobias,

This is indeed strange. Generally, if you set GridView's FontSize property, the font size of the whole GridView should be effected, including the ComboBoxColumn. I have tested this case and everything is working as expected. Please find attached my sample project for a reference.

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Michael Hilgers
Top achievements
Rank 1
answered on 16 Oct 2013, 11:13 AM
I'm expecting the same issue:

Standard radGridView, all columns have the same font style. Then i added a ComboBoxColumn, which has a bold font instead of the normal font weight all other columns have. Then i tried to change to gridView font size, all columns except the comboBoxColumn are affected.

So my conclusion is, that the current ComboBoxColumn doesn't share the gridView font style.

What can we do get the same font style in all columns?

Regards,
Michael

P.S.: Could this be a theme specific problem? I'm using the Windows8 theme, not the default theme!

0
Michael Hilgers
Top achievements
Rank 1
answered on 16 Oct 2013, 11:35 AM
CONFIRMED:

It's a theme problem! With default theme the ComboBoxColumns have the same font as all other grid columns. With the Windows8 theme, the ComboBoxColumns have a bolder font than all other grid columns.

I think this issue can only be solved by telerik.

Regards,
Michael
0
Yoan
Telerik team
answered on 21 Oct 2013, 02:51 PM
Hello Michael,

Indeed, you are right. We were able to reproduce this problem. We will investigate this case, but I cannot commit to a specific time frame when this will be fixed. As a workaround, I can suggest you to define the following style targeting RadComboBox control:

<Style TargetType="telerik:RadComboBox" telerik:StyleManager.BasedOn="Windows8">
            <Setter Property="FontSize" Value="33"/>
</Style>

You can set the same value as the one for your RadGridView.

Please excuse us for the inconvenience caused!

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Michael Hilgers
Top achievements
Rank 1
answered on 23 Oct 2013, 10:42 AM
Hello Yoan,

thank you for this workarround. Just one more question: where do i have to implement this XAML snippet? Not sure about this and my try's weren't successfull.

Regards,
Michael
0
Yoan
Telerik team
answered on 25 Oct 2013, 01:36 PM
Hi Michael,

You need to set Application theme:

public MainPage()
        {
            StyleManager.ApplicationTheme = new Windows8Theme();
            InitializeComponent();
        }

then you can define the style in GridView's resources:
<telerik:RadGridView Grid.Row="0"
                             Name="clubsGrid"                            
                             ItemsSource="{Binding Clubs}"
                             AutoGenerateColumns="False"
                             FontSize="33"
                             Margin="5">
            <telerik:RadGridView.Resources>
                <Style TargetType="telerik:RadComboBox" telerik:StyleManager.BasedOn="Windows8">
                    <Setter Property="FontSize" Value="33"/>
                </Style>
            </telerik:RadGridView.Resources>

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Tobias
Top achievements
Rank 1
Answers by
Tobias
Top achievements
Rank 1
Yoan
Telerik team
Michael Hilgers
Top achievements
Rank 1
Share this question
or