I want to show messages in my Mahapps application without graying out the background.
I already tried to find a way with custom themes and custom accents. But no luck so far.
Set the OverlayBrush of the MetroWindow to Transparent:
OverlayBrush = Brushes.Transparent;
await this.ShowMessageAsync("This is the title", "Some message");
Related
I have copied the ResourceDictionery from this link here which appears to be the same as an existing Accent.xaml file and changed the accent colors to my own custom colors.
I add my ResourceDictionary in the Application's Resources.
The issue I am seeing is that the background color of a dialog button does not get my custom accent color. If I were to guess it seems to be the Cobalt accent color.
EDIT Updated Question as I wrote above I only added my new Accent Colors to the ResourceDictionary of the Application. This seems to work for most things but not for the button color of a dialog. I tested with the Mahapps.Metro samples and found out that if you only add your custom Accent ResourceDictionary to the Applications resources then the background color of a button in the Dialog which should be the AccentColor will not work. I worked out (and could of read from the instructions :-) ) you need to use the ThemeManager and Override the OnStartUp event.
Now this leads to problem number 2. Here is my code that I have. The ThemeManger's DetectAppStyle function does not return anything.
Protected Overrides Sub OnStartup(e As StartupEventArgs)
Try
ThemeManager.AddAccent("NewAccent1", New Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/NewAccents/NewAccent1.xaml"))
Dim theme = ThemeManager.DetectAppStyle(Application.Current)
ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("NewAccent1"), theme.Item1)
Catch ex As Exception
Debug.Print(ex.Message)
End Try
MyBase.OnStartup(e)
End Sub
MahApps dialog's affirmative button uses AccentedDialogSquareButton style which is based on AccentedSquareButtonStyle. You can find them in MahApps' source tree as:
Themes\Dialogs\MessageDialog.xaml
Themes\Dialogs\BaseMetroDialog.xaml
All other buttons use SquareButtonStyle style defined in
\Styles\Controls.Buttons.xaml
If you want to override this behavior, changes to BaseMetroDialog.xaml and MetroDialog.xaml(for OK button) are required.
I am using LayoutAnchorable of Avalon Dock to dock my toolbar in my WPF application. Everything works fine. But as soon as I set the AllowTransparency property of parent window to true, it stopped working.
AnchorableControl is being shown as it should. When I unpin it, it docks itself to side of the window. But it nevers comes up upon hovering the mouse over it.
I am trying to find a workaround in the source control of Avalon dock. but there is lot to take and code isn't very straight.
Unfortunatly many Controls (including HWND etc.) are not working when AllowTransparency is set to true. But this is outdated anyway.
If you want to style your Window take a look at the WindowChrome Class and/or use a the very good Design Library MahApps.Metro
Edit:
Found the reason here.
In WPF, I want to add a userControl in/over titlebar in Window, like this:
The Red part is that UserControl, and the Green part is titlebar.
Now I hope to get some suggestions from you. Need to extend the Window class or just customize the style of the Window? It's better to provide source code.
You can do this by implementing your own title bar.
In order to do so set your window style to none:
WindowStyle="None"
This will mean that the window will have no control box (minimize, maximize, and close buttons) and you will need to implement your own.
You can take a look at the following links to get you started:
http://blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/
http://www.codeproject.com/Articles/140267/Create-Custom-Windows-in-WPF-with-Ease
http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm
How can I style the border and title bar of a window in WPF?
Good luck
You do not need to sub-class Window. You can adjust the style for Window: http://msdn.microsoft.com/en-us/library/aa969824.aspx.
This question is in regard to the Telerik RadButtons for Silverlight. I have themes per customer on the site where Silverlight is used. I am able to change the background and foreground colors by setting the Background and Foreground brush properties. However, the styles revert to the standard colors while hovering over the button. How do I change the colors for all button states?
I attempted to set the Resources dictionary as shown on Telerik Styles, but it appears to be read-only.
More information on how to style a RadButton you can find here: http://www.telerik.com/help/silverlight/radbuttons-styles-and-templates-overview.html
In WPF, how can I hide the minimize button (only the minimize, not also the maximize...) of a window.
The code in this forum almost work for me. The behavior of that code is that it's disabled the minimize button. But, how hide it?
http://forums.silverlight.net/forums/p/222067/532926.aspx
How about disabling the resize attribute?
ResizeMode="NoResize"
I think you would have to hide the default window title and draw your own titlebar.
e.g.: C# WPF Custom Title Bar Tutorial
and Moving a WPF Window with Custom Chrome