Mahapps Custom title bar color - wpf

Currently i am using <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
And this is the result:
I also found this supported colors: https://github.com/MahApps/MahApps.Metro/tree/master/MahApps.Metro/Styles/Accents
But i cannot find the Gray color that i want to change into.
Any idea how to change to custom color ?

You can set the title brush to whatever you want by setting WindowTitleBrush="Chocolate"
<Controls:MetroWindow x:Class="MetroDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:MetroDemo="clr-namespace:MetroDemo"
Title="MahApps.Metro - Demo Application"
WindowTitleBrush="Chocolate">
</Controls:MetroWindow>
Hope this helps!

Related

Design Time changes based on MaterialDesignInXAML

I am using MaterialDesignInXAML in WPF using C# (.net Core 3.1).
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
How do I set it to dark mode for the design time editor?
I set my main window to have:
TextElement.Foreground="{DynamicResource MaterialDesignForeground}"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
App.xaml has:
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
There is no code behind.
I know I can modify the Theme at runtime, that is not an issue. But I know there is a way to modify it at design time. (I want my Visual Studio window to show the dark background etc when editing.)
When running MaterialDesignToolKit.Full (from https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/releases) The MaterialDesignDemo.
It has dark mode enabled in the editor. I've been looking through it but can't seem to spot why.
I'm sure it's something simple but the app.xaml seems to be the same. I'm missing something obviously.
Any ideas?
You should set the BaseTheme property to Dark in your App.xaml to apply the dark theme:
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="DeepPurple" SecondaryColor="Lime" />

MaterialDesignInXaml TextBox and other UI elements unreadable when disabled

In our MaterialDesignInXaml project, we have some configuration pages which look like this:
Page Viewable
During processing, the configuration pages are disabled, but they should still be viewable. However, they look like this:
Page Not Viewable
In the App.xaml, we've included these resources:
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Indigo.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />
Can anyone advise on getting disabled UI to appear more readable?
A bit difficult to reproduce without your XAML code, but you can probably try to play with the Opacity and Foreground of the disabled items while disabling.

Find MahApps Metro title bar color

I am using MahApps Metro and i'm trying to get to TitleBar color to use it with other controllers:
In App.xaml file all i can see is:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
Which is the theme name, i can change BaseLight to Red for exapmle and my TitleBar become Red but i really like this color.
Any suggestions how to find this color ?
It should be
AccentColorBrush
You can access it like this:
<TextBox Background="{DynamicResource AccentColorBrush}" />

How to restyle wpf window like Blu twitter client

for a long time i am looking for trick to develop a Blu like window where some leaf image is coming out from title bar. how they design such layout.
here is small image of custom title bar
please some one tell me how could i design this type of title bar where something coming out from title bar.
You can achieve this by setting an appropriate background image for the window and setting AllowsTransparency to True:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowStyle="None" AllowsTransparency="True">
<Window.Background>
<ImageBrush ImageSource="/bg.png"/>
</Window.Background>
Then you have to create your own title bar, because the default one will not be displayed.

Image shows in Expression Blend but not during runtime

The image in question is located in a ControlTemplate inside of a ResourceDictionary similar to this (various details removed for clarity):
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<ControlTemplate x:Key="ImageTestTemplate" TargetType="ImageTest">
<Grid>
<Image Source="/MyAssembly;Component/Images/MyImage.png"/>
</Grid>
</ControlTemplate>
</ResourceDictionary>
When I view the control in Expression Blend the image shows up just fine, but when I run the app the image does not show up. If I drop the same image into a UserControl it also shows up just fine, so the problem has something to do with using the template.
Is there some other way I should be loading the image resource inside the template?
I don't think you need the leading '/'. The base resource path I'm using for a project is "IMLPrototype2;component/Model/Sounds/" in SL 3 & 4.

Resources