Skip to content

Commit

Permalink
Update docs, MaterialFormProvider now uses default label's size and f…
Browse files Browse the repository at this point in the history
…ont (#9)
  • Loading branch information
bubuntoid authored Dec 19, 2020
1 parent 1d53155 commit 8ede96e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class AuthentificationDialog : DialogContext

protected override void OnConfiguring(DialogContextOptionsBuilder builder)
{
builder.UseStyle(DialogStyle.Material)
builder.UseMaterialStyle()
.WithTitle("Authentification")
.WithButton("Sign in");

Expand Down Expand Up @@ -53,6 +53,7 @@ Base items that available "out of the box":
- NumericUpDownItem (decimal/int)
- CheckBoxItem (bool)
- ComboBoxItem (Collection)
- ListBoxItem (Collection)
- DateTimePickerItem (DateTime)

You can use your own control as dialog item by inerhiting from BaseDialogItem:
Expand All @@ -75,6 +76,46 @@ protected override void OnConfiguring(DialogContextOptionsBuilder builder)
}
```

## Themes
Material style has only two themes - Dark and Light, but it also supports color schemes, for using them you can use constant schemes from **MaterialColorScheme**:
```csharp
builder.UseMaterialStyle(MaterialTheme.Light, MaterialColorScheme.Indigo)
```
Or create your own, there is tons of available colors [here](https://github.com/bubuntoid/EasyDialog/blob/main/src/EasyDialog/Enums/MaterialThemePrimaryColor.cs):
```csharp
var scheme = new MaterialColorScheme()
{
Primary = MaterialThemePrimaryColor.BlueGrey800,
DarkPrimary = MaterialThemePrimaryColor.BlueGrey900,
LightPrimary = MaterialThemePrimaryColor.BlueGrey500,
Accent = MaterialThemeAccent.LightBlue200,
TextShade = MaterialThemeTextShade.White,
};

builder.UseMaterialStyle(MaterialTheme.Dark, scheme)
```
Available color schemes:
- Default
- Green
- LightGreen
- Red
- Amber
- Brown
- Teal
- Yellow
- Pink
- Purple
- DeepPurple
- Orange
- DeepOrange
- Lime
- LightBlue
- Indigo
- Grey
- Cyan

[Metro style themes](https://github.com/bubuntoid/EasyDialog/blob/main/src/EasyDialog/Enums/MetroTheme.cs).

## Dependencies
- System.Windows.Forms 4.0.0.0
- [MetroFramework](https://github.com/thielj/MetroFramework) 1.2.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AuthentificationDialog : DialogContext

protected override void OnConfiguring(DialogContextOptionsBuilder builder)
{
builder.UseMaterialStyle(MaterialTheme.Light, MaterialColorScheme.Cyan)
builder.UseMaterialStyle(MaterialTheme.Dark, MaterialColorScheme.Indigo)
.WithTitle("Authentification")
.WithButton("Sign in");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ public MaterialFormProvider(MaterialTheme theme, MaterialColorScheme colorScheme
Sizable = false
};

var defaultLabel = new Label();
var defaultFontFamilyName = defaultLabel.Font.FontFamily.Name;
var defaultLabelSize = defaultLabel.Font.Size;
defaultLabel.Dispose();

var materialSkinManager = MaterialSkinManager.Instance;
materialSkinManager.ROBOTO_REGULAR_11 = new System.Drawing.Font(materialSkinManager.ROBOTO_MEDIUM_10.FontFamily.Name, 10);
materialSkinManager.ROBOTO_REGULAR_11 = new System.Drawing.Font(defaultFontFamilyName, defaultLabelSize);
materialSkinManager.AddFormToManage(form);
materialSkinManager.Theme = (MaterialSkinManager.Themes)theme;
materialSkinManager.ColorScheme = new ColorScheme(
Expand Down

0 comments on commit 8ede96e

Please sign in to comment.