In order to force WPF to use a specific theme (skin), such as Aero, Luna, Royale, Classic, or Generic when using controls from Hierarchical Data Library for WPF, Gantt Chart Library for WPF, or Project Management Library for WPF you can use one of these approaches:
Get the appropriate DlhSoft control style and template definitions for the specific theme you want to apply (extracting them from the appropriate XAML file within the Control Styles sample archives) and add them to your own resource dictionary: this way you can also customize the style and template definitions as needed;
Use resource dictionary merging features and load the appropriate theme resources within your application in XAML; note that some UI objects may still use the actual runtime theme, regardless of these resources; the example below loads Luna.Homestead theme:
<Application.Resources>
<ResourceDictionary>
<!-- Load and include custom theme resource dictionaries. -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/PresentationFramework.Luna;V3.0.0.0;31bf3856ad364e35;Component\Themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="pack://application:,,,/DlhSoft.Data.Controls;;;Component\Themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="pack://application:,,,/DlhSoft.HierarchicalData.Controls;;;Component\Themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="pack://application:,,,/DlhSoft.ProjectData.Management.Controls;;;Component\Themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="pack://application:,,,/DlhSoft.ProjectData.GanttChart.Controls;;;Component\Themes/Luna.Homestead.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Not recommended except for testing purposes because this method uses Microsoft® internal APIs:
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
string themeName = "Luna";
string themeColor = "Homestead";
Type themeWrapper = Type.GetType(
"MS.Win32.UxThemeWrapper, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
FieldInfo themeNameField = themeWrapper.GetField("_themeName", BindingFlags.NonPublic | BindingFlags.Static);
themeNameField.SetValue(null, themeName);
FieldInfo themeColorField = themeWrapper.GetField("_themeColor", BindingFlags.NonPublic | BindingFlags.Static);
themeColorField.SetValue(null, themeColor);
base.OnStartup(e);
}
}