Posted 11 years ago by Pedro Oliveira - Chief Architect, Asgard Software
Version: 4.5.0480
Avatar
Hi there,

I'm using one of the Themes (Office 2007 Black) and need to customize some styles. For example I need to customize some brushes and colors used by the NavigationPane. What is the best way to do it?

Thank you, Pedro

Comments (6)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Pedro,

It's pretty easy, you would just put something like this in the Resources of your Application:
<SolidColorBrush x:Key="{x:Static themes:NavigationBarCommonDictionary.WindowBackgroundBrushKey}" Color="Red" />
Of course you could use any type of brush as long as it has the appropriate key. NavigationBarCommonDictionary has static properties with keys for the brushes used for that control.


Actipro Software Support

Posted 11 years ago by Pedro Oliveira - Chief Architect, Asgard Software
Avatar
I get an error when the application starts, says:

"Type reference cannot find public type named 'NavigationBarCommonDictionary'. Error at Line 8 Position 26"

Here is my code in App.xaml

<Application x:Class="Asgard.Client.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:ActiproSoftware.Windows.Controls.Navigation;assembly=ActiproSoftware.Navigation.Wpf30"
xmlns:themes="clr-namespace:ActiproSoftware.Windows.Themes;assembly=ActiproSoftware.Shared.Wpf30"
StartupUri="ShellWindow.xaml">
<Application.Resources>
<SolidColorBrush x:Key="{x:Static themes:NavigationBarCommonDictionary.WindowBackgroundBrushKey}" Color="Red" />
</Application.Resources>
</Application>

I'm referencing Actipro assemblies, is anything missing?
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Pedro,

Yes your namespace declarations are what is wrong. You should always define them like this instead since this way can reuse across multiple assemblies:
xmlns:navigation="http://schemas.actiprosoftware.com/winfx/xaml/navigation"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"

That change should fix it.


Actipro Software Support

Posted 11 years ago by Pedro Oliveira - Chief Architect, Asgard Software
Avatar
Thanks, that namesapace declaration solved the compiling problem, but still I cannot see the changes. I tried to put my resource key in the Application.Resources, RibbonWindow.Resources, or the NavigationPane.Resources section and still does not show the customization.

<Application.Resources>

<LinearGradientBrush x:Key="{x:Static themes:NavigationBarCommonDictionary.PaneHeaderBackgroundNormalBrushKey}" StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#FFA6A6A6" />
<GradientStop Offset="0.25" Color="#FF242424" />
<GradientStop Offset="0.26" Color="#FF030303" />
<GradientStop Offset="0.5" Color="#FF0E0E0E" />
<GradientStop Offset="1" Color="#FF474747" />
</LinearGradientBrush>
...

Any suggestion? Thanks
Posted 11 years ago by Pedro Oliveira - Chief Architect, Asgard Software
Avatar
finally I got some time and made a few tests and got it working. The reason why it was not showing the theme customizations was because I specified a design-time theme:

<ribbon:RibbonWindow x:Class="Asgard.Client.ShellWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
xmlns:navigation="http://schemas.actiprosoftware.com/winfx/xaml/navigation"
>
<DockPanel x:Name="panelShell" themes:ThemeManager.Theme="Office2007Black">

When we specify the Theme for the design-time using the workaround for the RibbonWindow, puting it on the DockPanel it overrides all the keys we may specify for theme customization.

Is there a way to set a design-time theme and still be able to customize it?
A suggestion, it would be very nice to have a theme builder application. Thanks.
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Pedro,

I was going to ask if you perhaps were setting the ThemeManager.Theme attached prop somewhere. That would definitely override it.

For the next maintenance release, we added a ThemeManager.DesignModeTheme attached property that works just like ThemeManager.Theme but doesn't alter anything at run-time. This should be very helpful.

Maybe you could email us more detail about your "theme builder application" idea.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.