Hi,
Im trying to customize the RoyalLightTheme. Basically i just want to change the Accent Color to blue and add a custom validation look to some editors.
I added some of the dictionaries in "\Infragistics\2019.2\WPF\Themes\RoyalLight" to my project and linked them via the Mappings. I got it working with some standard microsoft controls and the xamComboEditor. Im extending the theme as described in www.infragistics.com/.../thememanager-extending-existing-control-themeI have several questions.
1. Are all the styles that i need in the "\Infragistics\2019.2\WPF\Themes\RoyalLight folder or are some in "Infragistics\2019.2\WPF\DefaultStyles" ?
2. I saw there is a "ControlMappingKeys.XamDataGrid". What dictionary maps to this? There is none called xamDataGrid. How do i find this out myself?
3. Same as 2 but for more simple editors like XamTextEditor. There is only 1 dictionary "RoyalLight.xamEditors.xaml", but several keys in the ControlMappingKeys enum.
4. I added the RoyalLight.xamGrid.xaml dictionary to my project (hoping its the one for the xamDataGrid), but its full of errors. All looking like this "The name "CultureValueConverter" does not exist in the namespace "">schemas.infragistics.com/.../primitives". What do i do?5. Some dictionaries like the RoyalLight.xamEditors.xaml just look like this: Code I found those in "DefaultStyles/Windows", do i need to edit this, add them to my project, and reference those instead? All for a simple color change on xamTextEditor?
6. Is this even a "feasible" idea? It worked quickly with the sample and the xamComboEditor, but now it looks like i need to really dive into this and the first dictionary depends on another dictionary which depends on 2 dictionaries that are hidden within the general dictionaries which need primitive dictionaries...7. I could remember this wrong, but the first time i played around with this, i think there were typos in some of the dictionaries. Is there a clean version i can download somewhere? A "put these dictionaries in your project for this theme" file collection would be neat too, since they seem to be really all over the place.
Hello Martin,
All of the DataPresenter themes consist of three files in total. In this case, they are:
DataPresenterRoyalDarkDataPresenterRoyalDark_BrushesDataPresenterRoyalDark_Express
While in this sample there are a lot of brushes, there are styles in the other files using brushes as static resources. If you inspect these files, you will see that sometimes there is a merged dictionary pointing towards the Generic files of the theme.
This is because there are some shared styles.
What needs to be done in this case, is to overwrite all mappings, so they point to the resources you have defined.
I have modified the sample you have sent me. What I did was to add overwrite of the rest of the mappings as per the guide on our website here:
https://es.infragistics.com/help/wpf/thememanager-extending-existing-control-theme#_Ref398053010
In the xaml resource files I have included, I have also removed the reference to the Generic files.
Now the grid is all red, as all colors have been defined to be red.(With the exception of the XamTextEditor's background, as this is part of the editors group, and the default background of RoyalDarkTheme for it is black).
Please let me know if you have questions about this.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
7268.6204.ExtendTheme.zip
Well your sample just doesn't work.
See my attached sample. I played around with it and managed to turn a lot of stuff red, but not the hover effect. Also it seems like its a hover effect from an unstyled xamdatagrid, its not usual royal dark one.
Is it just not possible turning purple to blue? I don't understand how no one has ever done this before. How can this not be a common request?
www.file-upload.net/.../6204.ExtendTheme.rar.html
I have been looking further into this, and it seems that including brush resources is not guaranteed to work in this case, since brushes are used as static resources within the base theme, so they don't get resolved by styles using them.
There are a couple of suggestions I can make in this case.
First is, if the color is not broadly used in the application, just styling the component will do the job. In this case, DataRecordCellAreaBackground brush, is used only by the style for the DataRecordCellArea, meaning a style like this will resolve:<Style BasedOn="{x:Static themes:DataPresenterGeneric.DataRecordCellArea}" TargetType="{x:Type igDP:DataRecordCellArea}"> <Setter Property="Background" Value="Red" /> </Style>
The other option would be to include the resource dictionary that represents the base theme and merge it with the new resource dictionary that you will point.
I am attaching a sample extending Royal theme by overwriting few colors.
8053.6204.ExtendTheme.zip
this looks great and doable. Only problem is it doesn't seem to work for any other brushes.
I added all of these and not one of them worked.
<SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, DataRecordCellAreaBackgroundActive}" Color="Red"/> <SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, DataRecordCellAreaBackground}" Color="Red"/> <SolidColorBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, MergedCellFieldSelectedBackgroundKey}" Color="Red"/> <SolidColorBrush x:Key="{x:Static igDP:DataPresenterBrushKeys.MergedCellFieldSelectedBackgroundKey}" Color="Red"/> <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type igDP:XamDataGrid}, ResourceId=HScrollbarThumbBackgroundBrush}" Color="Red"/>
I got them from Snoop, from the DataPresenterRoyalLight_Brushes.xaml file or from the DataPresenterRoyalLight_Express.xaml file.
If i edit the colors directly in snoop the color turns red.
Both #1 and #2 work, 3 wont. . For instance, to change the label background of IGThemed XamDataGrid, you can do this:
<igDP:XamDataGrid BindToSampleData="True" Theme="IGTheme"> <igDP:XamDataGrid.Resources> <LinearGradientBrush x:Key="{ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelBackground}" StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0" Color="Red"/> <GradientStop Offset="0.93" Color="Green"/> <GradientStop Offset="0.98" Color="Blue"/> </LinearGradientBrush> </igDP:XamDataGrid.Resources> </igDP:XamDataGrid>
All the brushes used by a component can be found in the brush xaml file in the default styles of the component group.
However, some files so many brushes, so looking at the xaml can be quite confusing. For that I would recommend getting a tool that can inspect the elements and help you here(like snoopWPF).
Inspecting looks like this:
I've also attached the sample I used for this screenshot, it contains a dockmanager with some colors changed using #1 method.
Should you have any further questions, please let me know.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
2475.WpfApplication1.zip