How to change font size in a GridViewComboBoxColumn

10 posts, 0 answers
  1. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 26 Aug 2013 Link to this post

    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
  2. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 26 Aug 2013 Link to this post

    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
  3. DevCraft banner
  4. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 27 Aug 2013 Link to this post

    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
  5. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 06 Sep 2013 Link to this post

    My solution hat to many side effects. :(
    Does anybody know an other trick?

    Thanks!
  6. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 06 Sep 2013 Link to this post

    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 >>
  7. Michael Hilgers
    Michael Hilgers avatar
    76 posts
    Member since:
    Apr 2010

    Posted 16 Oct 2013 Link to this post

    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!

  8. Michael Hilgers
    Michael Hilgers avatar
    76 posts
    Member since:
    Apr 2010

    Posted 16 Oct 2013 Link to this post

    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
  9. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 21 Oct 2013 Link to this post

    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 >>
  10. Michael Hilgers
    Michael Hilgers avatar
    76 posts
    Member since:
    Apr 2010

    Posted 23 Oct 2013 Link to this post

    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
  11. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 25 Oct 2013 Link to this post

    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 >>
Back to Top
DevCraft banner