My team's project is in need a specific requirement for print preview. We have a dark mode for our application and need to create print preview for various views using the light mode. Please note, we are not using the ThemeManager control but rather using resource dictionaries and changing out the used dictionaries on App.xaml.
We have tried swapping out the dictionaries on App.xaml and we have had limited success on the XamReportPreview. Some of the styles will change and when printing to PDF, the controls will still retain their dark mode appearance.
Is there a way of changing the styles on the controls (Infragistic or otherwise) that we generate using the print preview function and if so is there a simple grey scale or black and white option that can applied to each control?
Thank you for your time with this requirement.
Thank you for contacting Infragistics Developer Support!
What controls are you using?How are you swapping out the dictionaries?Is there a reason you don’t want to use the theme manager?
We are using varying types of controls; Grids, borders, Textblocks, XamDatagrids, XamDataChart, etc.
To handle the dark/light mode switch we have two resources dictionaries for the associated styles/colors/brushes etc. One is always being used in App.xaml's resources and is changed by swapping the source of the resource dictionary with the URI of the appropriate mode being switched to.
We haven't used the Theme Manger in developing these dictionaries , however, we are not sure if we could create custom themes that can be switched on the fly for the XamReportPreivew.
Thank you again!
Thank you for your update. I have been investigating into this behavior you are seeing, but from your original response, I am a little bit unsure of the exact functionality that you are looking to achieve.
It sounds to me like you are currently using the XamReportPreview and would like to create a functionality where, if your application is currently using the dark theme, you are looking to create a report preview as if it was using a light theme. Can you please verify whether or not this is the case?
Please let me know if you have any other questions or concerns on this matter.
Yes that is correct.
Thank you for the update. From what you want to achieve it sounds like using the Theme Manager is the way to go as you can swap out themes with it. You can see a sample of this in our samples browser XamDataGrid > Style > Theming
You can also see some docs here about creating your own custom theme or extending an existing theme and applying a theme at the application level.
As for your current method Do you have an isolated sample that demonstrates swapping your dictionaries?
I have attached a sample project to demo roughly how we swap dictionaries. SampleProject.zip
Thank you for the update. Looking at your sample and the description of your issues I believe what is happening is with this method you are trying to override the styles to the Infragistics controls, however since some of the Infragistics controls can have specific requirements for overriding certain styles which can vary from control to control. Which means to flip between your custom light and dark themes you would have to import the themes/styles xaml for our controls to your project and override them there having a different set for light and dark. My recommendation would be to use the theme manager and modify and existing theme or create your own.