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

Not propoer style in RadMessageBoxControl

7 Answers 118 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 11 Jan 2012, 04:57 PM
In my application I'm overriding user theme with my theme. It's done via this standard method:

private void LoadTheme()
        {
            ResourceDictionary dictionaries = new ResourceDictionary();
            ResourceDictionary themeStyles = new ResourceDictionary { Source = new Uri("/Nexto;component/Resources/Theme.xaml", UriKind.Relative) };
            dictionaries.MergedDictionaries.Add(themeStyles);


            ResourceDictionary appResources = App.Current.Resources;
            foreach (DictionaryEntry entry in dictionaries.MergedDictionaries[0])
            {
                SolidColorBrush colorBrush = entry.Value as SolidColorBrush;
                SolidColorBrush existingBrush = appResources[entry.Key] as SolidColorBrush;
                if (existingBrush != null && colorBrush != null)
                    existingBrush.Color = colorBrush.Color;
            }
        }

My theme is LightBlue. Everything is ok except RadMessageBoxControl.
Standard MessageBox looks like in atachment "messagebox.png", but yours looks like in "radmessagebox.png". Seems like you taking colors not from overloaded theme but from phone theme.

I can of course overrid look by defining <Style TargetType="telerikMessageBox:RadMessageBoxControl"> But the problem is button - which got dark border instead light and "shadow" which is light and should be dark.

Any idea how to override all radmessagebox style or how to force it to use propoer theme?

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 16 Jan 2012, 11:03 AM
Hi Przemysław,

 Please send a small sample application that demonstrates the issue so that I may assist you further.
The information you provided is enough to determine why RadMessageBox does not respond to the changed resource.

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 16 Jan 2012, 06:32 PM
Hi

Sample application you can download from here http://www.cubicsoft.pl/download/PhoneApp1.zip

Compare MessageBox to RadMessageBox.

regards
0
Victor
Telerik team
answered on 17 Jan 2012, 12:43 PM
Hello Przemysław,

Thanks for the sample app, however, I am not sure I understand what is going on. In App.cs you are overwriting the colors of all brushes in Application.Current.Resources. Then, in your code, you are showing RadMessageBox when the MessageBox button is pressed and MessageBox when the RadMessageBox button is pressed, that is, the buttons and the messageboxes are swapped. This means that RadMessageBox is shown with the overwritten colors and therefore I am confused :) Perhaps the swapped buttons are the problem?

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 17 Jan 2012, 01:17 PM
Hi

Yeah I accidently swapped buttons :) Anyway you can see that standard MessageBox is dark when RadMessageBox is light. Any idea how to get "dark" RadMessageBox  in app like this, when I'm overriding theme?

regards
0
Victor
Telerik team
answered on 17 Jan 2012, 04:32 PM
Hi Przemysław,

It is possible to completely customize the UI of RadMessageBox only by specifying a new control template. This is because the default template uses the system resources which you are overwriting. The fact that the standard message box is nor influenced by the changes made to the system resources only indicates that it is not a part of Silverlight. So, in short, you have to retemplate RadMessageBox. You can directly copy the template from the online help and tweak it as necessary.

Please write again if you need further assistance.

Regards,
Victor
the Telerik team

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

0
Alex
Top achievements
Rank 1
answered on 27 Sep 2013, 06:42 AM
Hi Victor,

I have the same problem. I want to modify the buttons template from the main template of the rad message box.
All I want to do is to keep the white color of the foreground and BorderBrush, even if the phone's theme is dark or light.

I tried to create 2 buttons with styles inside this stackPanel, but it doesn't replace the existing buttons:

<StackPanel x:Name="PART_ButtonsPanel" Orientation="Horizontal"></StackPanel>

The question is: How and what should I style? This stackPanel or something else?

Thanks,
Alex

0
Todor
Telerik team
answered on 02 Oct 2013, 07:15 AM
Hi Alex,

The message box buttons are actually created in the code of RadMessageBox. We don't do anything specific to change their color. They just take the default resource called PhoneForegroundBrush. Since this is the expected Windows Phone experience, if you need to set a specific color, you will need to override that system resource. Here's how you can do it:

(Application.Current.Resources["PhoneForegroundBrush"] as SolidColorBrush).Color = Colors.White;

Please note that this will probably have an effect on other components in your app that use the same resource.
 
Regards,
Todor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
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
MessageBox
Asked by
Developer
Top achievements
Rank 1
Answers by
Victor
Telerik team
Developer
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Todor
Telerik team
Share this question
or