Mahapps.Metro dark theme not showing in designer - mahapps.metro

I am using MahApps.Metro version 1.2.0.0. I have set my theme to a Dark theme. This works fine when I run the application but still shows the light theme in my designer.
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
Thoughts on what is causing this issue?

I found that in XAML designer:
The window title bar is never styled
After restarting Visual Studio, the components seem to be styled...
...except for MetroWindow's background, which shows as white.
So, many components are white-on-white (invisible!) in the designer. I've been working around it, as follows.
For MetroWindows, I set the background of each to reference the theme color:
<Controls:MetroWindow
....
Background="{DynamicResource WindowBackgroundBrush}">
For user controls and pages, rather than set the background on every one, you can leave it transparent and set the designer to have a dark background. Then they show up well enough for designing:
It's a bodge, but its what I've been working with.

Related

How to prevent overriding from button styles in WPF

out current application is a DevExpress Ribbon window. However, we have some legacy code - including a WPF Control which was hosted through a WinForms Window - with WPF Host. (please dont ask why)
I wanted to change the UserControl at least to a Wpf Window to get rid of WinForms.
Now here is my Problem: All stlyes get totally messed up. Especially my buttons have a problem:
The buttons lose their assigned Images, and also Background and Foreground is not assignable. Through the Live Visual Tree from Studio I see that it is overridden.
I guess the thing with images leads to the same root cause.
I dont want to redo the whole window again in DevExpress (if this is the cause).
Is there a way for a window to not use some application styles and run as default? Or how can I find out, what is actually overriding everything?
I finally found the solution. The DevExpress was overriding any styles of any form in application, settings something to the DevExpress.Xpf.CoreTemeManager.
To disable a style, I had to add the following thing to my window:
<Window x:Class="AnotherWindow"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
dx:ThemeManager.ThemeName="NoneName"
<!-- ...-->
</Window>
Also include DevExpress.Data and DevExpress.Xpf.Core references.

DevExpress WPF theme in Design Pane of Visual Studio renders differently from compiled application look

I am developing an application with DevExpress 14.2.10.0 on WPF in Visual Studio 2013 12.0.40629.00 Update 5.
Compiled application looks diferent from Design Pane in Visual Studio
I use a custom theme developed and compiled with DevExpress WPF Theme Editor and use it in my project with this code:
public MainWindow()
{
var theme = new Theme("EstiwLight", "DevExpress.Xpf.Themes.EstiwLight.v14.2")
{
AssemblyName = "DevExpress.Xpf.Themes.EstiwLight.v14.2"
};
Theme.RegisterTheme(theme);
ThemeManager.ApplicationThemeName = "EstiwLight";
InitializeComponent();
}
Theme is properly linked with References tree in VS and copied locally with checkbox on theme reference settings pane.
If I use some of DevExpress themes, Design Pane is applying it normally.
But if I look at MailClient DevExpress WPF Demo, I see exactly the same situation:
MailClient DevExpress WPF Demo renders default theme incorrect
So the problem is obvious: how to apply custom theme correctly to render it in Design Pane of Visual Studio?
I see a similar question but I use different, (almost) updated software versions unlike this question from 2011.
I've run into this same issue as well.
Find the XAML line to set a custom DevExpress theme, and insert it into the header of your UserControl:
https://documentation.devexpress.com/#WPF/CustomDocument7407
By default, this theme will not be applied in the XAML designer unless you:
Comment out said line of XAML.
Compile project, wait for a re-render.
Comment in said line of XAML.
Compile project, wait for a re-render.
If nothing is working, press Ctrl-Shift-Escape to bring up Process Explorer, then kill the XAML designer rendering process (it will offer to reload):
http://blog.spinthemoose.com/2013/03/24/disable-the-xaml-designer-in-visual-studio/
These instructions work for VS2012, VS2013, VS2015, and DevExpress v14 and v15.
If you work out a better way, please let me know!!

No Title Bar Showing in WPF .net 4.5 MahApps.Metro MvvmCross Composite Application

Using MahApps Metro 1.1.2.0 in a .net 4.5 WPF MvvmCross (HotTuna 3.5.0) composite application, developing and running on Windows 7.
Have followed the quick start guide but when I run the app I see no title bar on the window.
The resources are added to the host application and I am not seeing
System.Windows.ResourceDictionary Warnings, e.g. 9 : Resource not found; ResourceKey='IdealForegroundColorBrush'
I have manually added the following properties to MainWindow.xaml but still no joy.
ResizeMode="CanResize"
ShowCloseButton="True"
ShowIconOnTitleBar="True"
ShowInTaskbar="True"
ShowMaxRestoreButton="True"
ShowMinButton="True"
ShowSystemMenuOnRightClick="True"
ShowTitleBar="True"
I added padding before the first control and made the background transparent on the mvx user control which is loaded into mainwindow by the view presenter to ensure it was not sitting on top of the menu, but all I see is a black background from the top of the window until the content begins.
Interestingly, adding a GlowBrush to main window does have an effect:
GlowBrush="{DynamicResource AccentColorBrush}"
Any help welcome.
Thanks

Changing The MahApps Metro Theme

I know that the MahApps metro theme comes with "themes" (colour sets), but I don't know how to change them from the default settings in my WPF application.
I have followed the beginners tutorial at MahApps.Metro Documentation (including adding the resource libraries at the top of the page), but it makes no mention about changing the theme.
The component/Styles/Colours.xaml file has the comment "from the cosmopolitan theme pack", which may be a helpful clue to someone better versed in WPF design than me.
I'm talking about an app-wide theme change, not an individual control.
If you want to change the default colour scheme, just change which colour resource file is loaded.
from Blue:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
to Red:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml" />
You can also change programatically (once you've loaded every colour resource file) using ThemeManager.ChangeTheme().

WIndows Phone Theme Settings

I'm trying to get my app certified with the light theme for Windows Phone. I'm using a few custom ListBox styles, but I can't figure out why no pivot controls are visible. The foreground and background are both white, so they're invisible. I can't find any implicit or applied styles on the pivot control. TextBlocks have the same problem. From what I've read, the theme settings should be handled by the OS shouldn't they?
You don't need to re-define system resources since those are automatically added to the application at runtime, therefore rendering your ResourceDictionary redundant (and pretty much useless). Try applying the default system styles first. Also, post the XAML so that it is easier to help you fix it.

Resources