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

DialogCoordinator.ShowMessageAsync Button Accent #2468

Closed
Hikerakashiya opened this Issue Apr 12, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@Hikerakashiya

Hikerakashiya commented Apr 12, 2016

What steps will reproduce this issue?

I am using the DialogCoordinator to display dialogs and I noticed when a dialog is displayed it does not use the colors of my custom theme. I tried setting the MetroDialogSettings and setting ColorScheme, but none of the choices for ColorScheme have an affect on the button colors of the dialog. No matter what I set for the ColorScheme, the OK button was always using the light blue theme color.

Expected outcome

Dialog buttons are themed with the current set theme.

Environment

  • MahApps.Metro v1.2.4
  • Windows 7.0
  • Visual Studio 2013
  • .NET Framework 4.5
@punker76

This comment has been minimized.

Member

punker76 commented Apr 14, 2016

@Hikerakashiya This is a little bit tricky and must be explained on main mahapps docu (tba)

The dialogs use there own button styles https://github.com/MahApps/MahApps.Metro/blob/develop/MahApps.Metro/Themes/Dialogs/BaseMetroDialog.xaml#L6-L24

So if you want to override this styles you must create your own res dictionary with the style overrides and put this on the DialogSettings.CustomResourceDictionary.

    <Style BasedOn="{StaticResource SquareButtonStyle}" TargetType="{x:Type Button}">
        <Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
        <!-- Your custom style changes -->
    </Style>

    <Style x:Key="AccentedDialogSquareButton"
           BasedOn="{StaticResource AccentedSquareButtonStyle}"
           TargetType="{x:Type Button}">
        <Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
        <!-- Your custom style changes -->
    </Style>

    <Style x:Key="AccentedDialogHighlightedSquareButton"
           BasedOn="{StaticResource HighlightedSquareButtonStyle}"
           TargetType="{x:Type Button}">
        <Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
        <!-- Your custom style changes -->
    </Style>
yourDialogSettings.CustomResourceDictionary = new ResourceDictionary { Source = new Uri("pack://application:,,,/YourReallyCoolApp;component/CustomStyles/CustomDialogStyles.xaml") }

Hope this helps!

@Hikerakashiya

This comment has been minimized.

Hikerakashiya commented Apr 14, 2016

@punker76 Thanks for the response. Why can't the dialog inherit the styles from the main overall theme? It does not seem intuitive this way. Also how does the ColorScheme setting work for dialog settings?

@punker76

This comment has been minimized.

Member

punker76 commented Apr 14, 2016

@Hikerakashiya You maybe totally right, so I'll look at this point. The ColorScheme setting handles e.g. background and foreground brushes...

@robertmuehsig

This comment has been minimized.

robertmuehsig commented Dec 13, 2016

I had the same problem and discovered that I missed to include

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />

in the App.xaml

Without this reference the dialog will always appear in the "default" light theme with blue as the color.

@punker76 punker76 added this to the 1.6.0 milestone Jan 14, 2018

@punker76

This comment has been minimized.

Member

punker76 commented Jan 15, 2018

This should work now in upcoming v1.6.0 since the Dialog and Flyout controls try to find the current theme. So a custom theme or accent wont be override anymore.

2018-01-15_09h44_35
2018-01-15_09h44_45

@punker76 punker76 closed this Jan 15, 2018

@punker76 punker76 removed the Enhancement label Feb 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment