Skip to content

Commit a18bc1d

Browse files
committed
Merge branch 'master' into release
2 parents 8ae9b20 + 092f551 commit a18bc1d

File tree

83 files changed

+2949
-1046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2949
-1046
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ bld/
1919
[Bb]in/
2020
[Oo]bj/
2121

22+
# Visual Studio 2015/2017 cache/options directory
23+
.vs/
24+
2225
# Roslyn cache directories
2326
*.ide/
2427

@@ -231,4 +234,4 @@ $RECYCLE.BIN/
231234
*.lnk
232235

233236
#React.JS
234-
.module-cache
237+
.module-cache

.paket/paket.exe

157 KB
Binary file not shown.

MainDemo.Wpf/App.xaml.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
using System.Collections.Generic;
33
using System.Configuration;
44
using System.Data;
5+
using System.Globalization;
56
using System.Linq;
7+
using System.Threading;
68
using System.Threading.Tasks;
79
using System.Windows;
10+
using System.Windows.Markup;
811

912
namespace MaterialDesignColors.WpfExample
1013
{
@@ -13,5 +16,17 @@ namespace MaterialDesignColors.WpfExample
1316
/// </summary>
1417
public partial class App : Application
1518
{
19+
protected override void OnStartup(StartupEventArgs e)
20+
{
21+
//Illustration of setting culture info fully in WPF:
22+
/*
23+
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
24+
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
25+
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
26+
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
27+
*/
28+
29+
base.OnStartup(e);
30+
}
1631
}
1732
}

MainDemo.Wpf/Buttons.xaml

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
xmlns:system="clr-namespace:System;assembly=mscorlib"
77
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
88
xmlns:wpfExample="clr-namespace:MaterialDesignColors.WpfExample"
9+
xmlns:domain="clr-namespace:MaterialDesignDemo.Domain"
910
mc:Ignorable="d"
10-
d:DesignHeight="400" d:DesignWidth="800">
11+
d:DesignHeight="500" d:DesignWidth="800">
1112
<UserControl.Resources>
1213
<ResourceDictionary>
1314
<ResourceDictionary.MergedDictionaries>
@@ -89,7 +90,8 @@
8990
</materialDesign:PopupBox>
9091
</StackPanel>
9192
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
92-
<materialDesign:PopupBox Margin="16,0,16,0" StaysOpen="True">
93+
<CheckBox Name="PopupEnabled">Enable Popup</CheckBox>
94+
<materialDesign:PopupBox Margin="16,0,16,0" StaysOpen="True" IsEnabled="{Binding IsChecked, ElementName=PopupEnabled}">
9395
<Grid Width="300" Margin="8,8,8,8">
9496
<Grid.Resources>
9597
<Style TargetType="CheckBox" BasedOn="{StaticResource MaterialDesignCheckBox}">
@@ -151,23 +153,46 @@
151153
</materialDesign:PopupBox>
152154
</StackPanel>
153155
</Grid>
154-
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 16 0 0">
155-
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 0 8 0" Width="100"
156+
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 20 0 0">
157+
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 12 8 0" Width="100"
156158
ToolTip="Resource name: MaterialDesignRaisedLightButton">
157159
_LIGHT
158160
</Button>
159-
<Button Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 0 8 0" Width="100"
161+
<Button Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 12 8 0" Width="100"
160162
ToolTip="Resource name: MaterialDesignRaisedButton">
161163
_MID
162164
</Button>
163-
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Margin="0 0 8 0" Width="100"
165+
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Margin="0 12 8 0" Width="100"
164166
ToolTip="Resource name: MaterialDesignRaisedLightDarkButton">
165167
_DARK
166168
</Button>
167-
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}" Margin="0 0 8 0" Width="100"
169+
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}" Margin="0 12 16 0" Width="100"
168170
ToolTip="Resource name: MaterialDesignRaisedAccentButton">
169171
ACCENT
170172
</Button>
173+
<materialDesign:Badged Margin="0 12 16 4" Badge="3">
174+
<Button>MAIL</Button>
175+
</materialDesign:Badged>
176+
177+
<materialDesign:Badged Margin="0 12 16 4" Badge="{materialDesign:PackIcon Heart}"
178+
BadgeColorZoneMode="Accent">
179+
<Button>LOVE</Button>
180+
</materialDesign:Badged>
181+
182+
<materialDesign:Badged Margin="0 12 28 4" Badge="DANGER"
183+
BadgeColorZoneMode="Dark">
184+
<Button>STATUS</Button>
185+
</materialDesign:Badged>
186+
<materialDesign:Badged Margin="0 12 28 4"
187+
x:Name="CountingBadge"
188+
BadgeColorZoneMode="PrimaryDark">
189+
<Button Style="{StaticResource MaterialDesignRaisedLightButton}"
190+
Click="CountingButton_OnClick">CLICK ME!</Button>
191+
</materialDesign:Badged>
192+
<Button Content="{materialDesign:PackIcon AirplaneTakeoff}"
193+
Margin="0 12 8 4"
194+
ToolTip="Icon">
195+
</Button>
171196
</StackPanel>
172197
<StackPanel Grid.Row="3" Margin="0 24 0 0" Orientation="Horizontal">
173198
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}"
@@ -230,7 +255,14 @@
230255
</ToggleButton>
231256
</StackPanel>
232257
<StackPanel Grid.Row="1" Margin="0 16 0 0" Orientation="Horizontal">
233-
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" Margin="0 0 8 8" VerticalAlignment="Center" IsChecked="True">
258+
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" Margin="0 0 8 8" VerticalAlignment="Center" Tag="True">
259+
<RadioButton.IsChecked>
260+
<Binding Path="Tag" RelativeSource="{RelativeSource Self}">
261+
<Binding.ValidationRules>
262+
<domain:IsCheckedValidationRule />
263+
</Binding.ValidationRules>
264+
</Binding>
265+
</RadioButton.IsChecked>
234266
Radio
235267
</RadioButton>
236268
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" Margin="0 0 8 8" VerticalAlignment="Center">
@@ -243,15 +275,22 @@
243275
<CheckBox Style="{StaticResource MaterialDesignCheckBox}" Margin="0 0 8 8" VerticalAlignment="Center">
244276
Check
245277
</CheckBox>
246-
<CheckBox Style="{StaticResource MaterialDesignCheckBox}" Margin="0 0 8 8" VerticalAlignment="Center" IsChecked="True">
278+
<CheckBox Style="{StaticResource MaterialDesignCheckBox}" Margin="0 0 8 8" VerticalAlignment="Center" Tag="True">
279+
<CheckBox.IsChecked>
280+
<Binding Path="Tag" RelativeSource="{RelativeSource Self}">
281+
<Binding.ValidationRules>
282+
<domain:IsCheckedValidationRule />
283+
</Binding.ValidationRules>
284+
</Binding>
285+
</CheckBox.IsChecked>
247286
Mate
248287
</CheckBox>
249288
<CheckBox Style="{StaticResource MaterialDesignCheckBox}" Margin="0 0 8 8" VerticalAlignment="Center"
250289
IsEnabled="False" IsChecked="True">
251290
Disabled
252291
</CheckBox>
253292
</StackPanel>
254-
<StackPanel Grid.Row="2" Margin="0 16 0 0" Orientation="Horizontal">
293+
<StackPanel Grid.Row="2" Margin="0 16 0 0" Orientation="Horizontal">
255294
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center"
256295
ToolTip="Default ToggleButton Style"/>
257296
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="8 0 0 0" IsEnabled="False" />
@@ -263,8 +302,19 @@
263302
ToolTip="MaterialDesignSwitchDarkToggleButton" IsChecked="True" />
264303
<ToggleButton Style="{StaticResource MaterialDesignSwitchAccentToggleButton}" VerticalAlignment="Center" Margin="8 0 0 0"
265304
ToolTip="MaterialDesignSwitchAccentToggleButton" IsChecked="True" />
305+
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="8 0 0 0"
306+
ToolTip="MaterialDesignSwitchToggleButton with Content and ToggleButtonAssist.OnContent">
307+
<materialDesign:PackIcon Kind="Pin" RenderTransformOrigin=".5,.5">
308+
<materialDesign:PackIcon.RenderTransform>
309+
<RotateTransform Angle="45" />
310+
</materialDesign:PackIcon.RenderTransform>
311+
</materialDesign:PackIcon>
312+
<materialDesign:ToggleButtonAssist.OnContent>
313+
<materialDesign:PackIcon Kind="Pin"/>
314+
</materialDesign:ToggleButtonAssist.OnContent>
315+
</ToggleButton>
266316
</StackPanel>
267-
<StackPanel Grid.Row="3" Margin="0 16 0 0" Orientation="Horizontal">
317+
<StackPanel Grid.Row="3" Margin="0 16 0 0" Orientation="Horizontal">
268318
<ToggleButton Style="{StaticResource MaterialDesignFlatToggleButton}" ToolTip="MaterialDesignFlatToggleButton">
269319
<materialDesign:PackIcon Kind="Paperclip" Height="21" Width="21" />
270320
</ToggleButton>
@@ -281,6 +331,7 @@
281331
</ToggleButton>
282332
</StackPanel>
283333

334+
<!-- the following based on https://material.io/guidelines/components/buttons.html#buttons-toggle-buttons -->
284335
<ListBox Grid.Column="1" Grid.Row="0" Style="{StaticResource MaterialDesignToolToggleListBox}" SelectedIndex="0">
285336
<ListBox.ToolTip>
286337
<StackPanel>
@@ -302,32 +353,7 @@
302353
<materialDesign:PackIcon Kind="FormatAlignJustify"/>
303354
</ListBoxItem>
304355
</ListBox>
305-
306-
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignToolToggleFlatListBox}" SelectedIndex="0">
307-
<ListBox.ToolTip>
308-
<StackPanel>
309-
<TextBlock Text="MaterialDesignToolToggleFlatListBox" />
310-
<TextBlock Text="Exclusive selection" />
311-
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
312-
</StackPanel>
313-
</ListBox.ToolTip>
314-
<ListBoxItem>
315-
<materialDesign:PackIcon Kind="FormatAlignLeft"/>
316-
</ListBoxItem>
317-
<ListBoxItem>
318-
<materialDesign:PackIcon Kind="FormatAlignCenter"/>
319-
</ListBoxItem>
320-
<ListBoxItem>
321-
<materialDesign:PackIcon Kind="FormatAlignRight"/>
322-
</ListBoxItem>
323-
<ListBoxItem>
324-
<materialDesign:PackIcon Kind="FormatAlignJustify"/>
325-
</ListBoxItem>
326-
</ListBox>
327-
328-
<ListBox Grid.Column="1" Grid.Row="2" Style="{StaticResource MaterialDesignToolToggleListBox}"
329-
SelectionMode="Extended"
330-
Margin="0 8 0 0">
356+
<ListBox Grid.Column="1" Grid.Row="2" SelectionMode="Extended" Style="{StaticResource MaterialDesignToolToggleFlatListBox}">
331357
<ListBox.ToolTip>
332358
<StackPanel>
333359
<TextBlock Text="MaterialDesignToolToggleListBox" />

MainDemo.Wpf/Buttons.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,16 @@ private void PopupBox_OnClosed(object sender, RoutedEventArgs e)
4949
{
5050
Console.WriteLine("Just making sure the popup has closed.");
5151
}
52+
53+
private void CountingButton_OnClick(object sender, RoutedEventArgs e)
54+
{
55+
if (CountingBadge.Badge == null || Equals(CountingBadge.Badge, ""))
56+
CountingBadge.Badge = 0;
57+
58+
var next = int.Parse(CountingBadge.Badge.ToString()) + 1;
59+
60+
CountingBadge.Badge = next < 21 ? (object)next : null;
61+
62+
}
5263
}
5364
}

0 commit comments

Comments
 (0)