RadMessageBox font size problem

7 posts, 0 answers
  1. Developer
    Developer avatar
    8 posts
    Member since:
    Apr 2008

    Posted 07 Nov 2011 Link to this post

    Hi

    I'm using telerik for WP in my project, but seems there is some problem with RadMessageBox font size (see attachment). Text "Are you sure you want to delete the project with its content?" is much to small.

    Sample code is taken from Examples:

    RadMessageBox.Show("Delete project", MessageBoxButtons.YesNo, "Are you sure you want to delete the project with its content?", "Delete content");

    It's WP 7.1 application. Version of libraries: 2011.3.1026.2040

    Any ideas why?

    regards

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 07 Nov 2011 Link to this post

    Hi Developer,

     Thank you for writing.

    I am afraid that I could not reproduce the small font size. I pasted the code you provided and the text looks normal.
    Please post a support ticket and attach a small sample application that demonstrates this issue so that I can assist you.

    I am looking forward to your reply.

    Regards,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Developer
    Developer avatar
    8 posts
    Member since:
    Apr 2008

    Posted 07 Nov 2011 Link to this post

    Hi

    I've found the problem. 

    The problem occurs when I'm using Microsoft.Phone.Controls.Toolkit with your libraries.

    On Screen1.png you got proper messagebox when Toolkit isn't used.
    On Screen2.png it's messagebox with Toolkit.

    That's because i'm using Toolkit transitions. Seems like when I change
    RootFrame = new PhoneApplicationFrame();
    to
    RootFrame = new TransitionFrame();

    It's in private void InitializePhoneApplication() method in App.xaml.cs the problem occurs.

    Any ideas how to avoid this problem?

    regards
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 08 Nov 2011 Link to this post

    Hello Developer,

     Thank you for the clarification.
    We are aware that the Silverlight Toolkit does some application wide modifications which are not always appropriate. What most likely happens is that they are defining a default style for ContentControl or TextBlock.
    Try setting your own default style for each of these controls on your page, this should override the toolkit styles.

    Another thing you can do is to declare this style for RadMessageBox in your Page's resources:

    <Style TargetType="telerikMessageBox:RadMessageBoxControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikMessageBox:RadMessageBoxControl">
                    <Border Padding="12"
                            Background="{StaticResource PhoneChromeBrush}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
     
                            <ContentControl x:Name="PART_Title"
                                            HorizontalContentAlignment="Left"
                                            FontSize="{StaticResource PhoneFontSizeLarge}"
                                            FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                            Margin="{StaticResource PhoneMargin}"/>
     
                            <ContentControl Grid.Row="1"
                                            HorizontalContentAlignment="Left"
                                            x:Name="PART_Message"
                                            FontSize="{StaticResource PhoneFontSizeNormal}"
                                            Margin="12, 12, 12, 24"/>
     
                            <CheckBox x:Name="PART_CheckBox"
                                      Grid.Row="2"
                                      HorizontalAlignment="Left"
                                      VerticalAlignment="Bottom"/>
     
                            <ContentControl Grid.Row="3"
                                            x:Name="PART_ButtonsContainer"
                                            HorizontalContentAlignment="Stretch">
                                <ContentControl.ContentTemplate>
                                    <DataTemplate>
                                        <StackPanel x:Name="PART_ButtonsPanel"
                                                    Orientation="Horizontal">
                                        </StackPanel>
                                    </DataTemplate>
                                </ContentControl.ContentTemplate>
                            </ContentControl>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    Notice how the message part has FontSize explicitly set. You can set it whatever value you need.

    You will also need this namespace declaration:
    xmlns:telerikMessageBox="clr-namespace:Telerik.Windows.Controls.MessageBox;assembly=Telerik.Windows.Controls.Primitives"

    Please write again if you need further assistance.

    Best wishes,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Developer
    Developer avatar
    8 posts
    Member since:
    Apr 2008

    Posted 08 Nov 2011 Link to this post

    Now looks great (after using template). Thanks for fast response.

    regards
    Jakub Florczyk
  7. Peter
    Peter avatar
    9 posts
    Member since:
    Aug 2016

    Posted 07 Aug in reply to Victor Link to this post

    Hi Victor,

    Could you suggest how to change the font size of RadMessageBox for winform application using C#?

    Thanks,

    Peter

  8. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    138 posts

    Posted 08 Aug Link to this post

    Hello Peter,

    Just to confirm, are you asking for UI for Winforms' RadMessageBox? Although this is the forum for Windows Phone controls (UI for Windows Phone 7), I can provide you with the answer.

    //change the title bar font
    RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Arial", 12);
     
    foreach (Control ctrl in RadMessageBox.Instance.Controls)    
    {
        if (ctrl is RadLabel)
        {
            //change the main text font
            ctrl.Font = new System.Drawing.Font("Tahoma", 22);         
        }
        if (ctrl is RadButton && ctrl.Name == "radButton1")        
        {
            //change the button font
            ctrl.Font = new System.Drawing.Font("Consolas", 12);     
        }
    }
     
    RadMessageBox.Show("My RadMessageBox");


    In the future, if you have any further questions regarding the UI for Winforms controls, here is the UI for Winforms Forums and you can also open a support ticket here.

    Thank you for contacting Support and for choosing Telerik by Progress!

    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner