Hi Luc,
Yes, it is possible to change the selected theme for a grid but this functionality is not well tested because it was not meant to be used externally. In next versions we are going to provide a better way for changing a theme using the API.
There are two things you should know to change a theme:
1. You can obtain list of all available themes using the SavedThemes property of DGVEThemesManager class. In order to find a desired theme by name iterate through the collection and check the property SettingsName:
Dim Themes As BindingList(Of DGVENotDataSourceSpecificSettings) = DGVEThemesManager.SavedThemes
2. To change a theme you actually have to copy the theme settings (in your case from theme 'Luc_A' or 'Luc_B') to the settings that are currently applied to the DataGridView control. Bellow you can see the code snippet how to change the theme of a control 'dataGridView' with a selected theme.
Dim
Themes As BindingList(Of DGVENotDataSourceSpecificSettings) = DGVEThemesManager.SavedThemes
Dim MyTheme As DGVENotDataSourceSpecificSettings = ...'Find the desired theme by name
'Suspend persistence and event handling
DataGridViewExtensionComponent.Extension.SuspendPersistenceOfSettingsForDataGridViewControl( dataGridView )
DataGridViewExtensionComponent.Extension.SuspendEventHandlingOfSettingsForDataGridViewControl( dataGridView )
'Copy the settings from the theme to the current settings of the grid view control
MyTheme.CopyTo( DataGridViewExtensionComponent.Extension( dataGridView ).NotDataSourceSpecificSettings )
'Resume persistence and event handling
DataGridViewExtensionComponent.Extension.ResumeEventHandlingOfSettingsForDataGridViewControl( dataGridView )
DataGridViewExtensionComponent.Extension.ResumePersistenceOfSettingsForDataGridViewControl( dataGridView )
'Force save of the changes
DataGridViewExtensionComponent.Extension.ForcePersistenceOfSettingsForDataGridViewControl( dataGridView, PersistedSettingsType.All )
DataGridViewExtensionComponent.Extension.ForceApplyingOfSettingsToDataGridViewControl( dataGridView )
NB! Keep in mind that DataGridView Extension manages the grids when visualized for first time, and if you try to obtain the settings
'DataGridViewExtensionComponent.Extension( dataGridView )' for a grid view control before that moment you will get null(Nothing).
If you have any other questions do not hesitate to ask us.
Yours Sincerely,
Support Team