xmlns:ig="http://schemas.infragistics.com/xamlThemes"
This topic demonstrates how to add a ResourceWasher™ component to your application and use it for washing the colors defined in your resources.
You need to first read the following topics:
The table below lists some of the configurable behaviors of the ResourceWasher component.
Add the Infragistics namespace.
Add required NuGet packages
In order to use a ResourceWasher in your application, you must add the Infragistics.WPF NuGet package to your project. For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.
Add the Infragistics namespace
In XAML:
xmlns:ig="http://schemas.infragistics.com/xamlThemes"
In Visual Basic:
Imports Infragistics.Windows.Themes
In C#:
using Infragistics.Windows.Themes;
Adding ResourceWasher component to an application.
In XAML:
<ig:ResourceWasher />
In Visual Basic:
Dim resourceWasher As ResourceWasher = New ResourceWasher()
In C#:
ResourceWasher resourceWasher = new ResourceWasher();
The following table maps the desired configurations to property settings. The properties are directly accessed from the ResourceWasher class.
Define the color that used in washing resources.
An important part of setting up the ResourceWasher component is to set the color used in the process:
In XAML:
<ig:ResourceWasher WashColor="[your color]" />
In Visual Basic:
resourceWasher.WashColor = [your color]
In C#:
resourceWasher.WashColor = [your color];
Set the moment the washing process will start.
If you want the resources to be processed immediately after they are loaded then you set the AutoWash property to true:
In XAML:
<ig:ResourceWasher AutoWash="True" />
In Visual Basic:
resourceWasher.AutoWash = True
In C#:
resourceWasher.AutoWash = true;
If you want to start the washing process manually, set the AutoWash property to false and call the WashResources method in your code:
In Visual Basic:
resourceWasher.WashResources()
In C#:
resourceWasher.WashResources();
Set the type of the color change applied.
There are two methods for color washing supported by the ResourceWasher – HueSaturationReplacement and SoftLightBlend. Set the WashMode property of the ResourceWasher to the method of your choice:
In XAML:
<ig:ResourceWasher WashMode="SoftLightBlend" />
In Visual Basic:
resourceWasher.WashMode = WashMode.SoftLightBlend
In C#:
resourceWasher.WashMode = WashMode.SoftLightBlend;
Set the source dictionary to be used in the process
In XAML:
<ig:ResourceWasher.SourceDictionary>
<ig:ResourceWasher Source="[your dictionary]" />
<ig:ResourceWasher.SourceDictionary>
In Visual Basic:
resourceWasher.SourceDictionary = [your dictionary]
In C#:
resourceWasher.SourceDictionary = [your dictionary];
Use different wash colors and modes for different elements in one dictionary.
In order to wash different elements with different wash setting (or exclude some elements from washing), you must define elements in groups using the attached property ig:ResourceWasher.WashGroup. In order to exclude a group from washing you can set the ig:ResourceWasher.IsExcludedFromWash to true:
In XAML:
<Page.Resources>
<SolidColorBrush x:Key="Background1" Color="Wheat"
ig:ResourceWasher.WashGroup="WashGroup1"
ig:ResourceWasher.IsExcludedFromWash="False" />
<SolidColorBrush x:Key="Background2" Color="BlueViolet"
ig:ResourceWasher.WashGroup="WashGroup2"
ig:ResourceWasher.IsExcludedFromWash="False" />
<SolidColorBrush x:Key="Background3" Color="Honeydew"
ig:ResourceWasher.WashGroup="WashGroup3"
ig:ResourceWasher.IsExcludedFromWash="True" />
<SolidColorBrush x:Key="Background4" Color="Orange"
ig:ResourceWasher.WashGroup="WashGroup4"
ig:ResourceWasher.IsExcludedFromWash="False" />
</Page.Resources>
Once the wash groups are defined in the resources you can add them in a WashGroupCollection and set it to the component’s WashGroups property:
In XAML:
<ig:ResourceWasher WashColor="Red">
<ig:ResourceWasher.WashGroups>
<ig:WashGroupCollection>
<!--This one will be washed in Red-->
<ig:WashGroup Name="WashGroup1" />
<!--This one will override the Red and will be washed in Blue-->
<ig:WashGroup Name="WashGroup2" WashColor="Blue" />
<!--This one will NOT be washed at all because it is defined as IsExcludedFromWash="True"-->
<ig:WashGroup Name="WashGroup3" />
<!--WashGroup4 will be washed in red as it is a part of the ResourceDictionary
being Washed-->
</ig:WashGroupCollection>
</ig:ResourceWasher.WashGroups>
</ig:ResourceWasher>