Skip to main content

IThemeChangingHandler.OnThemeChanged() Method

In This Article

This method is called when a grid theme is changed.

Namespace: DevExpress.Mobile.DataGrid.Theme

Assembly: DevExpress.Mobile.Grid.v18.2.dll

#Declaration

void OnThemeChanged()

#Remarks

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

Use this method to force your custom control to react on a theme change. To do this, follow the steps below:

  1. Implement the IThemeChangingHandler interface for your control.

    public class CustomButton : IThemeChangingHandler {
         public CustomButton() {
    
         }
    }
    
  2. Call the ThemeManager.AddThemeChangedHandler method from your control’s constructor to add the control to the list of delegates handling the ThemeManager.ThemeChanged event.

    public class CustomButton : IThemeChangingHandler {
         public CustomButton() {
              ThemeManger.AddThemeChagedHandler(this);
         }
    }
    
  3. Implement the OnThemeChanged method for your control. For example, it may call your control’s method used to repaint it.

    public class CustomButton : IThemeChangingHandler {
         public CustomButton() {
              ThemeManger.AddThemeChagedHandler(this);
         }
         void OnThemeChanged(object Sender, EventArgs e) {
              RepaintButton();
         }
    }
    
See Also