An alternative approach to changing the theme using one of the predefined Microsoft templates is to add some XAML directly into the action. One use of this would be to change the title of the main USD window.
Create an action, same as previously, then add the xaml into the data field. This action will then need adding to the DesktopReady event of your global container.
Notice below how I have made the following change in the xaml;
<Style x:Key="MainWindow" TargetType="{x:Type Window}" BasedOn="{StaticResource {x:Type Window}}"> <Setter Property="Background" Value="{DynamicResource WindowHeaderStyle}"/> <Setter Property="MinWidth" Value="1024"/> <Setter Property="MinHeight" Value="768"/> <Setter Property="Visibility" Value="Visible"/> <Setter Property="WindowState" Value="Normal"/> <Setter Property="SizeToContent" Value="Manual"/> <Setter Property="Title" Value="Neil Parkhurst Plc - Demo of USD"/> <Setter Property="FontFamily" Value="Segoe UI" /> </Style>
Note: in my example below the action call is order 2. As in order 1 is used to set predefined theme. As described in my earlier post. Then action 2 is used to change the title on the screen.
Code is as follows (you could cut and paste this or you can find a copy on Microsoft site!)
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mucc="clr-namespace:Microsoft.Uii.Csr;assembly=Microsoft.Uii.Csr.Core" xmlns:control="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" xmlns:controlStyles="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls.Styles;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" xmlns:usd="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" xmlns:usdDesktop="clr-namespace:Microsoft.Crm.UnifiedServiceDesk" xmlns:resx="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Properties" xmlns:usdPanelLayouts="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.PanelLayouts;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" xmlns:classic="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell" xmlns:usdstyle="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls.Styles;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" xmlns:ProgressIndicator="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.RoundProgressIndicator;assembly=Microsoft.Crm.UnifiedServiceDesk.RoundProgressIndicator" xmlns:system="clr-namespace:System;assembly=mscorlib"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/ToolBar/Styles.xaml"/> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/Expander/Styles.xaml"/> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/ComboBox/Styles.xaml"/> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/Textblock/Styles.xaml"/> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/ScrollBar/Styles.xaml"/> <ResourceDictionary Source="pack://application:,,,/Microsoft.Xrm.Tooling.Ui.Styles;component/Resources/Button/Styles.xaml"/> </ResourceDictionary.MergedDictionaries> <Style x:Key="MainWindow" TargetType="{x:Type Window}" BasedOn="{StaticResource {x:Type Window}}"> <Setter Property="Background" Value="{DynamicResource WindowHeaderStyle}"/> <Setter Property="MinWidth" Value="1024"/> <Setter Property="MinHeight" Value="768"/> <Setter Property="Visibility" Value="Visible"/> <Setter Property="WindowState" Value="Normal"/> <Setter Property="SizeToContent" Value="Manual"/> <Setter Property="Title" Value="Neil Parkhurst Plc - Demo of USD"/> <Setter Property="FontFamily" Value="Segoe UI" /> </Style> </ResourceDictionary>
Pingback: Learning USD | My experiences with Microsoft Dynamics CRM
the link to your previous post is dead, I think it should be “https://neilparkhurst.com/2015/10/19/usd-change-theme-simple/” instead of “https://neilparkhurst.com/2015/08/13/usd-change-theme-simple/”.
Still many thanks for your blog, I’m starting to read about USD and it’s quite useful.
LikeLike
Thanks Michael, I have had a problem with a few of the links on my site. (WordPress decided it was a good idea to change quite a few!) I am fixing them as I find them.
LikeLike
Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk
Pingback: Learning Unified Service Desk | Microsoft Dynamics CRM and Unified Service Desk
Pingback: USD – Custom Branding | Microsoft Dynamics CRM and Unified Service Desk