Not propoer style in RadMessageBoxControl

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

    Posted 11 Jan 2012 Link to this post

    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?
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 16 Jan 2012 Link to this post

    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 >>

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

    Posted 16 Jan 2012 Link to this post

    Hi

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

    Compare MessageBox to RadMessageBox.

    regards
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Jan 2012 Link to this post

    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 >>

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

    Posted 17 Jan 2012 Link to this post

    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
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Jan 2012 Link to this post

    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 >>

  8. Alex
    Alex avatar
    3 posts
    Member since:
    Nov 2011

    Posted 27 Sep 2013 Link to this post

    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

  9. Todor
    Admin
    Todor avatar
    778 posts

    Posted 02 Oct 2013 Link to this post

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