question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with MahApps styling + Backstage

See original GitHub issue

Hi,

Firstly, thank you for creating this great project, it’s really good.

At the moment we have solved most of our outstanding issues but one. We are trying to theme things programmatically to be in sync with MahApps but have come across an issue. The issue is basically that if we programmatically set a custom accent colour, when opening the Backstage/BackstageTabControl, not all of the styling works (some things are not styles, buttons have no mouse over effect, etc.

Using MahApps, we are doing the following. it works and styles the Fluent.Ribbon correctly.

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);

    var theme = new Theme("MahAppsRoyalDark", "MahAppsRoyalDark", ThemeManager.BaseColorDark, "Red", Colors.MediumPurple, Brushes.MediumPurple, true, false);
    ThemeManager.Current.ChangeTheme(this, theme);
}

The problem we’ve got is that we do not want to use one of the standard Microsoft colours but wish instead to provide our own.

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);

    var customColor = new Color
        {
            R = 116,
            G = 70,
            B = 185
        };

    var theme = new Theme("MahAppsRoyalDark", "MahAppsRoyalDark", ThemeManager.BaseColorDark, "Red", customColor, new SolidColorBrush(customColor), true, false);
    ThemeManager.Current.ChangeTheme(this, theme);
}

This time this sort of works, but the behaviour is a little unexpected, with the styling partially applied (the button mouse hovering etc. does not work as expected). TLDR; if I use a standard Microsoft colour to change the theme accent, all is ok. If I use my own, it isn’t.

By any chance have you come across this issue before? Is it something I’m doing incorrectly?

Thanks in advance.


Environment

  • Fluent.Ribbon 9.0.4
  • Windows 10 21H1
  • .NET 6

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
batzencommented, Sep 4, 2022

You are welcome.

0reactions
SkinnySackboycommented, Sep 4, 2022

Brilliant thanks @batzen it works now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Ribbon Style · Issue #401 · MahApps ...
I was looking at some office 2013 screenshots and noticed the ribbon has a flat, metro look. Are there any plans to add...
Read more >
MahApps style should not apply to all items
I noticed when adding the MahApps.Metro styles to my resource dictionary that these styles are being applied to all items within my ...
Read more >
Usage
Usage. This guide will introduce you to the themes that MahApps.Metro has and how to create your own. All of MahApps.Metro 's themes...
Read more >
Thememanager
Thememanager. MahApps.Metro has a ThemeManager class that lets you change the theme using code-behind. It can be done in 1 line, like so:...
Read more >
Migration to v2.0
Migration to v2.0. This guide assumes the migration from version 1.6.5 to 2.0. Main Breaking Changes. All marked obsolete code were removed; Drop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found