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

RadMessageBox font size problem

6 Answers 332 Views
MessageBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Developer
Top achievements
Rank 1
Developer asked on 07 Nov 2011, 12:41 PM
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

6 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 07 Nov 2011, 04:39 PM
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 >>

0
Developer
Top achievements
Rank 1
answered on 07 Nov 2011, 05:30 PM
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
0
Victor
Telerik team
answered on 08 Nov 2011, 10:04 AM
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 >>

0
Developer
Top achievements
Rank 1
answered on 08 Nov 2011, 02:05 PM
Now looks great (after using template). Thanks for fast response.

regards
Jakub Florczyk
0
Peter
Top achievements
Rank 1
answered on 08 Aug 2016, 02:07 AM

Hi Victor,

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

Thanks,

Peter

0
Lance | Manager Technical Support
Telerik team
answered on 08 Aug 2016, 05:38 PM
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
Tags
MessageBox
Asked by
Developer
Top achievements
Rank 1
Answers by
Victor
Telerik team
Developer
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or