Styling WPF controls inline with Infragistics themes - wpf

we are using Infragistics WPF controls (e.g. xamDataGrid, xamDockManager etc), and we will be using the Infragistics Office 2007 Blue theme which these controls support.
We also want to style the rest of the application (i.e. standard WPF controls) using the same Office 2007 Blue style.
What's the best approach? Are there Office 2007 themes/skins that we can download or purchase? Can we use anything from the Infragistics download?

I know this is an old question, but maybe little update can be helpful for anyone that stumbles upon this. It is working in current version of Infragistics. Resource in App.xaml in enough. Sources point to folder in solution that contains files from Infragistics themes (usually something like C:\Program Files (x86)\Infragistics\2015.1\WPF\Themes).
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Theme/Styles.Shared.xaml" />
<ResourceDictionary Source="/Theme/Styles.WPF.xaml" />
<ResourceDictionary Source="/Theme/Theme.Colors.xaml" />
<ResourceDictionary Source="/Theme/IG.MSControls.Core.Implicit.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

IIRC for winforms infragistics allow you to use the app stylist to be able to theme the standard controls.
Just had a quick look on the forums and it doesn't look like it can be done for WPF.
How to apply themes to non-Infragistics controls

Related

Styling project in visual studio solution (WPF XAML)?

Regarding this question and Marc's answer, I find this solution perfect, but I have trouble organizing my solution to make it functional.
How can I create a styling project that contains only XAML and reference to sub XAML, and how can I use it elsewhere in my solution? What is the visual studio project used by Marc in his answer to create the styling project?
Thank you,
B
You could create a WPF User Control Library in Visual Studio and add ResourceDictionary items where you define your XAML resources to it.
You then add a reference to this WPF User Control Library from your WPF Application project (Project->Add Reference in Visual Studio) and merge the resource dictionaries that are defined in the library in the App.xaml of your application:
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication4"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/WpfUserControlLibrary1;component/Dictionary1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Replace "WpfUserControlLibrary1" with the name of the WPF User Control Library and "Dictionary1" with the name of the ResourceDictionary that you added to this project.

Catel Orchestra theme only works in designer?

Hello I'm trying to apply a theme to Fluent Ribbon but unfortunately it doesn't work. But what interesting in the visual studio designer everything works. Here is the code with I try to do it, and one more question. How to disable full screen mode in the main window?
<Application x:Class="WLDA.Server.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Windows8/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Test App
This might be caused by the Fluent Ribbon styles being automatically added by Orchestra for you (and they default to Office 2013).
One solution could be to remove the existing dictionary from Application.Current.Resources.MergedDictionaries and add the Windows 8 instead.
You could use the Orchestra repository (with examples) to test if this works.

WPF Adding a 'Resource' Project to a solution with multiple WPF applications

I am developing three kiosk-like applications in WPF. They will share a similar look and feel, and I was hoping to create the projects all in the same solution. What I would like to do is add a project to the solution that just holds shared resources, such as fonts and images.
My question is, is it possible to share resources like embedded fonts across applications, and if so, what is the appropriate project type for this use? (class library? WPF user control?)
I would create a WPF Custom Control Library, then create a ResourceDictionary to hold the resources, where in the App.xaml of your start-up project I would link the Resource dictionary.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/myResourceLibrary;component/myResourceDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
That way, you can just move the DLL around to whichever solution you want to use it in.

How to properly organize XAML resources in Silverlight?

I'm having some issues with resource files in my modular application.
I have Infrastructure.DLL and some custom controls inside this DLL. Those controls using templates from themes/generic.xaml
Issue that I have - Blend doesn't recognize those resources. Visual studio does.
Ideally I'd like to have styles for my cusom controls inside generic.xaml and styles for other controls somewhere else in common library that I can reference from my modules.
I also need Expression Blend and VS to work properly.
How do I arrange solution to make it happen?
PS. Important! WPF is different but I'm interested in Silverlight solution
You just need to create design time resource for your generic.xaml in order to let Blend recoganize it. Take a look at this post.
In each of your modules, you create a ResourceDictionary like this.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
Source="/xxx.Silverlight.Controls;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Also, in your .csproj file, you need to add this. Please note that normally this piece of code is auto-generated by Blend, so if your ResourceDictionary is auto-generated, you don't need to do the following.
<Page Include="Design\DesignTimeResources.xaml" Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>
Design is the folder I created for storing my DesignTimeResources.xaml. I pretty much have the same structure as yours. :)

ResourceDictionary in WPF Control Library

We are creating an office ribbon that opens up a WPF window that is stored in another WPF Control library project.
That WPF window has some themes attached to it that is stored in a ResourceDictionary that is compiled in a separate project.
However when we load up the WPF window, all the themes from the ResourceDictionary are lost.
We can fix this by manually/forcing the theme on the window itself, but this seems like a bad solution. So my question is: how can I load the theme of the new WPF window from the Office Addin application?
Uri uri = new Uri("/Nov.Presentation.RigDoc.WpfResources;component/Shared.xaml", UriKind.Relative);
Resources.MergedDictionaries.Add(Application.LoadComponent(uri) as ResourceDictionary);
I just tried this with Office 2010 (actually using a 2007 VSTO Addin but running it in 2010) and it works perfectly.
I´ve got an external project´s library referenced in the VSTO project and I use this following xaml in the control to link in the resource dictionary.
<UserControl.Resources>
<ResourceDictionary>
<!-- Link in th general styles -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyAssemblyName;component/MyResourceDictionaryName.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Other style... -->
</ResourceDictionary>
</UserControl.Resources>
Otherwise I could think of it being a problem with your styles being overrided by some later explicit or implicitly linked in styles. If it cannot find the assembly you reference it should throw an example so the problem shouldn't be therein.

Resources