Loading...

Powershell GUI : Add MahApps Metro Theme with Powershell

1 A+ A-


In a previous post I have shown you how to add the Elysium theme to your GUI.
In this post I will show you how to add MahApps Metro Theme to your Powershell GUI.
I usually use Elysium theme but a colleague has shown me this theme, and I found it just awesome.
I created a very simple GUI to show you some possibilities that you can use with MahApps and use control with Powershell.

MahApps is very pretty and there are many possibilities.
Moreover it's very well documented.

How it looks ?
You can configure the TitleBar to add button, icons ...
You can find below in my testing tool some buttons and TabControl.
Overview of some buttons using MahApps

One of the control I like with MahApps is the Flyout control.

In my example you can use it by clicking on the below button.
Expand button
See the result below :
Overview of the Flyout control using MahApps
Flyout content
Overview of some progressbar using MahApps

How to get this sample GUI ?

How to use it ?

1 / Add Mahapps on Visual Studio
Go to  "Tools\Library Package Manager\Package Manager Console"
Type "Install-Package MahApps.Metro"


2 / Add Mahapps to your XAML
Replace <Window with <Controls:MetroWindow 
Replace the last  line </Windows> with</Controls:MetroWindow>        
Add the below line to your XAML
3 / Add Mahapps to your PS1

To use MahaApps you have to add below lines in your PS1 script.



4 / Add an icon

With MahApps you can add easylly icons to your controls, as MetroCircleButton.
All icons are integrated in MaHapps. 

You can see them on this link.

For an example if you want to integrate an icon to your button :
  1. Choose your icon on the website
  2. Click on the icon to check the name
  3. In your XAML add it  and replace "." with "_"
Icons for MahApps
5 / Customize the Title bar

You can add some icons buttons in your TitleBar as below :

6 / Add a Flyout control
Add the below part in your XAML


Add a button to display your flyout
Add the below part to your PS1 to add an action to your button


How to see more ?
This theme has been created by Paul Jenkins, and is maintained by Brendan ForsterDennis DaumeAlex Mitchell and Jan Karger.

The MahApps website is very well done and organized with many helpull guides.

You can see Here, how to use some controls which are more often used as :
  • Buttons
  • DataGrid
  • Dialogs
  • Flyouts
  • ProgressBar
  • ProgressRing
  • TextBox
  • TabControl
  • and more ...

You can find Here, some guides to use MahApps.
XAML 8120804022620573701

Enregistrer un commentaire

1 commentaire

Anonyme a dit…

Bonjour,
Vous publiez beaucoup mais vos codes ne fonctionnent pas toujours et votre site contient des erreurs 404.
Vos interfaces sont propres du moins de ce qui est présenté, mais vous n'etes pas très clair dans vos énoncés ce qui fait que le débogage est quasi impossible.
Cdt,
M.Picart

Accueil item

Award

Sponsors

Learn KQL in one month

You want to support me ?

Mes articles en français

Books in French


Stats