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

Issues with themes

7 Answers 323 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Hugh
Top achievements
Rank 1
Hugh asked on 09 Mar 2012, 06:02 PM
When dynamically changing themes with the rich text box, only certain associated dialogs, etc change after the initial render.

For example, I've included a picture of the Font editor (right-click rich text box and select Font..).  What happens is the button faces (buttons, combo boxes, etc) will remain at whatever theme was selected the first time you bring up the dialog.  In this case, I had originally brought up the dialog with the expression dark theme.  I then switched to office blue and brought it back up.  As you can see most of the elements switched over to office blue as expected, but not all.

The same situation holds true with the paragraph properties dialog, and the right-click menu itself.  

http://i.minus.com/iEWdJu7KP521a.png





As an aside, one thing I'm curious about is the text box itself.  While the border and corner radius change based on the theme, the default text color and background do not change.  I assume that was intentional, but have you considered having an option for it to change as well?

7 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 13 Mar 2012, 02:37 PM
Hello Hugh,

There are some specifics regarding the theme of the control and its pop-ups.
In order to ensure that the chosen theme will be correctly applied to all pop-ups that RadRichTextBox uses, the theme should be set on application level. In addition, the root visual has to be reset.

This blog post provides more details and a walk-through on implementing on-the-fly changing of the themes. Please, have a look at it and let us know if you need further assistance.

Kind regards,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Hugh
Top achievements
Rank 1
answered on 14 Mar 2012, 05:30 PM
The blog post is for silverlight ... does it apply to WPF as well?  

In our project there isn't an app startup in quite that manner.  There isn't a WPF rootvisual to my knowledge.  

Also, wouldn't this essentially blow away whatever child dialogs are open?  The silverlight example looks to be destroying and then recreating the main page/window/dialog?





A little background on our setup.  We have a main resource dictionary that includes all of our styles, etc. and also sets telerik and applicable system controls' StyleManager.Theme to a dynamic resource.  That resource and other theme-specific styling, brushes, etc. are specified within a set of theme resource dictionaries.

At launch, the main resource dictionary and the default skin resource dictionary are added to the application's merged dictionary.  Changing themes involved removing the current theme from the merged dictionary and adding the selected one.
0
Boby
Telerik team
answered on 20 Mar 2012, 10:02 AM
Hi Hugh,
In order application theme to be applied, controls should be re-added to the visual tree after applying it - so yes, the dialogs should be closed and you should apply some additional logic if you need to preserve their state.
You can review the project attached to this forum post from Vanya for an idea on how change the theme at run-time. If it doesn't fit your scenario, you can send us attached (through a support ticket) sample project illustrating it, so we can help you further.

Greetings,
Boby
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Hugh
Top achievements
Rank 1
answered on 03 Apr 2012, 10:45 PM
Thank you for the help and sorry for the delay.  Unfortunately the suggested project from Vanya does not fix the issue.  I am able to replicate it using that project.





I made the following changes to the project in order to test:

1) I updated the Telerik references to use the current version (2012.1.215.40), and included the needed references for RadRichTextBox (here's a picture of the references - references)

2) I added a RadRichTextBox to UserControl1's StackPanel:

<UserControl x:Class="WpfApplication1.UserControl1"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
	<StackPanel Width="200">
		<Button Content="Default" Click="Default_Click" />
		<Button Content="Vista" Click="Vista_Click" />
		<Button Content="Windows7" Click="Windows7_Click" />
        <Button Content="Office_Silver" Click="Button_Click"/>
        <Button Content="Office_Blue" Click="Button_Click_1"/>
        <Button Content="ExpressionDark" Click="Button_Click_2"/>
            <telerik:RadComboBox Margin="5">
			<telerik:RadComboBoxItem Content="item 1" />
			<telerik:RadComboBoxItem Content="item 2" />
			<telerik:RadComboBoxItem Content="item 3" />
			<telerik:RadComboBoxItem Content="item 4" />
		</telerik:RadComboBox>
        <telerik:RadButton Margin="5" Content="RadButton"/>
        <telerik:RadRichTextBox></telerik:RadRichTextBox>
        <telerik:RadNumericUpDown Margin="5"/>
        <telerik:RadCalendar Margin="5"/>
        <telerik:RadBusyIndicator Margin="5" IsBusy="True"/>
	</StackPanel>
</UserControl>




Doing the same order of events as in my project, I was able to replicate the issue.  In this case, I did the following:

1) Clicked the OfficeBlue button

2) Right-clicked the RadRichTextBox and selected Font (the dialog appears as expected)

3) Closed the Font dialog

4) Clicked the ExpressionDark button

5) Right-clicked the RadRichText and selected Font

As you can see from the included picture below, both the Right-click menu and the Font Dialog now contain styles from both themes.  In the case of the Right-Click menu, the only thing that changed to the new theme (ExpressionDark) is the fonts and the highlighting.   Everything else has remained OfficeBlue.

In the case of the dialog, most items have changed to the new theme (ExpressionDark), but button faces (buttons, combo boxes, etc) still remain OfficeBlue.  If you do a similar order of events, the Paragraph Properties dialog will show the same issues.

Dialogs
0
Accepted
Vasil
Telerik team
answered on 06 Apr 2012, 03:51 PM
Hello Hugh,

The wrong behavior is caused by the fact that RadRichTextBox uses MEF to load its UI. Once a dialog is loaded and shown, MEF caches the pop-up. After changing the theme, subsequent firing of the commands shows the pop-ups from their cached state. In order to get Vanya's project to work correctly for RadRichTextBox, just edit the ResetContent method as follows:

public void ResetContent()
{
     RadCompositionInitializer.Catalog = new DependencyCatalog("Telerik.Windows.Documents");
     this.Content = new UserControl1();
}

If you have not added a reference to System.ComponentModel.Composition, you must add it now. In this way, a new initial catalog with empty cache will be created after each theme change.

With the official Q1 SP1 release of RadControls we introduced Implicit Styles for our controls. For detailed information please refer to this help article. I have also prepared a sample project for you which demonstrates run-time changing of implicit themes for RadRichTextBox.

Let us know if you have any other questions.

Kind regards,
Vasil
the Telerik team

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

0
Hugh
Top achievements
Rank 1
answered on 06 Apr 2012, 05:16 PM
Vasil,

Thank you for the info.  Re-initializing the catalog seems to have done the trick!  

The method I'm using for real-time skinning is actually quite different from Vanya's, but this was easy to place within my design.  When I have the chance I'll look into the Implicit Styles and see if that might be applicable in the future.  From a quick glance, I suspect it would fit in well with how I'm doing skinning.




BTW - There still is one thing you may want to look into regarding the RichTextBox.  In the Paragraph Dialog (right-click RichTextBox), none of the RadNumericUpDown controls (Left, Right, Before, After, and By) are using the Telerik theme.  This isn't related to the dynamic theme changing as far as I can tell.  They are always default grey regardless of what theme is set before opening for the first time.

This is a minor bug, but it would be good if it was corrected in the future.   Without it, the method you recommended is technically isn't a complete fix since some controls are not being themed at all.
0
Vasil
Telerik team
answered on 10 Apr 2012, 02:25 PM
Hi Hugh,

Thank you for getting back to us.

Unfortunately, we are not aware of such an issue. I have tested the ParagraphPropertiesDialog with binaries from 2012 Q1 release (2012.1.215), but the RadNumericUpDown controls look as expected in all Telerik themes. Please, refer to the attached archive where I have included some screenshots from my verification.

Could you elaborate more about this problem? It will be great if you can isolate it and send us a sample code or project using a support ticket.

Looking forward to your response.

Regards,
Vasil
the Telerik team

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

Tags
RichTextBox
Asked by
Hugh
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Hugh
Top achievements
Rank 1
Boby
Telerik team
Vasil
Telerik team
Share this question
or