Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid with Fluent theme does not update when changing theme mode #9410

Closed
SamVanheer opened this issue Nov 10, 2022 · 7 comments · Fixed by #10149
Closed

DataGrid with Fluent theme does not update when changing theme mode #9410

SamVanheer opened this issue Nov 10, 2022 · 7 comments · Fixed by #10149
Labels

Comments

@SamVanheer
Copy link

Describe the bug
When using a DataGrid in an application that uses Fluent theme, changing the theme mode from light to dark or vice versa does not update the grid theme.

To Reproduce
Steps to reproduce the behavior:

  1. Create an application that uses Fluent theme and DataGrid
  2. Add a datagrid to the main window
  3. Add button or other input method to change the fluent theme mode
  4. Grid header does not change

Expected behavior
The datagrid should change themes just like built-in controls.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 0.10.18

Additional context

Restarting the application and having the theme applied from the start works as expected.

I included the DataGrid fluent theme in my App.axaml:

<Application.Styles>
    <FluentTheme Mode="Light"/>
    <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
</Application.Styles>

The DataGrid control does not use custom styles or templates.

I'm changing the theme like this:

if (Application.Current!.Styles[0] is FluentTheme theme)
{
    theme.Mode = FluentThemeMode.Light; //FluentThemeMode.Dark;
}
@maxkatz6
Copy link
Member

See #7659

Also it was fixed in 11.0 I think https://github.com/AvaloniaUI/Avalonia/pull/8163/files

@SamVanheer
Copy link
Author

Thanks, 11.0.0-preview3 works properly.

@Sputnik24
Copy link

Sputnik24 commented Feb 6, 2023

Cannot confirm. With 11.0.0-preview5, workaround is still needed. Without, it looks like this:

image

@timunie
Copy link
Contributor

timunie commented Feb 6, 2023

@Sputnik24 I don't think it's the same issue. The appereance is similar, however now even the white background is there if you start with dark theme applied. If no issue for this is open, please open a new one.

@maxkatz6 maxkatz6 reopened this Feb 13, 2023
@maxkatz6
Copy link
Member

Not the same issue, but observable problem and workaround are the same.

@0x90d
Copy link
Contributor

0x90d commented Feb 13, 2023

I can confirm that it was working fine without workaround in preview 4 (I havent used any earlier preview versions). In preview 5 its broken (again?).

@0x90d
Copy link
Contributor

0x90d commented Feb 13, 2023

I cannot get the "workaround" to work. But there is also no code snippet, maybe I'm doing something wrong. What's more weird is that if I remove Datagrid style from App.xaml and add it in code after changing to dark mode, the Datagrid Column Headers are still white:
image

image

Before I've tried (the order of removing and adding seems to be unrelated. I tried removing / adding before and after changing to dark without any difference):
image

Can someone please post the mentioned workaround or tell me what I'm doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants