MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.28k stars 2.45k forks source link

Wrong foreground/text color with dark theme under frame #3365

Closed ivanjx closed 5 years ago

ivanjx commented 5 years ago

Describe the bug When im using this library's dark theme (BaseDark), i noticed that text color is not converted/applied properly if the control is under a Frame (currently only textblock faced this issue). Please fix this.

To Reproduce Steps to reproduce the behavior:

  1. Apply base dark theme.
  2. Add a frame under mainwindow.
  3. Add a new page.
  4. Add a textblock on that newly created page.
  5. Load that page under mainwindow's Frame.
  6. Run the app.

Expected behavior Textblock control text color converted properly to match the theme (should be white).

Screenshots

Running app result: screenshot_34

Environment:

App.xaml contents:

<Application x:Class="xtreme_unlock_gui_new.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:xtreme_unlock_gui_new"
             Startup="Application_Startup">
    <Application.Resources>
        <ResourceDictionary>
            <FontFamily x:Key="FontAwesomeSolid">Resources/Fonts/fa-solid.otf#Font Awesome 5 Free Solid</FontFamily>
            <FontFamily x:Key="FontAwesomeBrand">Resources/Fonts/fa-brands.otf#Font Awesome 5 Brands Regular</FontFamily>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />                
                <ResourceDictionary Source="Styles/BlackDataGridStyle.xaml" />
                <ResourceDictionary Source="Styles/HamburgerMenuStyle.xaml" />

                <ResourceDictionary Source="Resources/Languages/EN.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
punker76 commented 5 years ago

@realivanjx To fix this issue just add the style to the page Style="{DynamicResource MetroPage}". This is the same WPF issue like if you want to use a default style for a Window. I can fix this only by adding the style explicit to the Page or I create a derived class like MetroPage which get's the style with the DefaultStyle key.

ivanjx commented 5 years ago

Is MetroPage style available on version 1.6.5? I tried but vs2017 seems to not detecting it

punker76 commented 5 years ago

@realivanjx Yes, it's added via Controls.xaml.

ivanjx commented 5 years ago

Is it under this? I use this for MetroWindow but idk for MetroPage:

xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
punker76 commented 5 years ago

@realivanjx It's a style not a Control.

ivanjx commented 5 years ago

Thanks. It runs successfully and fixes the issue but vs2017 somehow throws an error:

'Page' TargetType does not match type of element 'PageInstance'

Is that normal?

punker76 commented 5 years ago

@realivanjx I don't know, this is related to which VS you use and/or which SDK...