Skip to content

Commit f62a116

Browse files
committed
Merge remote-tracking branch 'refs/remotes/ButchersBoy/master' into ComboBox
2 parents 4a0912c + 33a3e4e commit f62a116

File tree

145 files changed

+1120
-697
lines changed

Some content is hidden

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

145 files changed

+1120
-697
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@
9393
<Grid Width="300" Margin="8,8,8,8">
9494
<Grid.Resources>
9595
<Style TargetType="CheckBox" BasedOn="{StaticResource MaterialDesignCheckBox}">
96-
<Setter Property="Margin" Value="8,8,8,8"/>
96+
<Setter Property="Margin" Value="8,8,10,8"/>
9797
</Style>
9898
<Style TargetType="TextBox" BasedOn="{StaticResource MaterialDesignTextBox}">
9999
<Setter Property="materialDesign:HintAssist.IsFloating" Value="True"/>
100-
<Setter Property="Margin" Value="8,16,8,8"/>
100+
<Setter Property="Margin" Value="8,8,8,8"/>
101101
</Style>
102102
</Grid.Resources>
103103
<Grid.ColumnDefinitions>
@@ -109,14 +109,26 @@
109109
<RowDefinition Height="*"/>
110110
<RowDefinition Height="*"/>
111111
<RowDefinition Height="*"/>
112+
<RowDefinition Height="*" />
112113
</Grid.RowDefinitions>
113114
<TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource MaterialDesignTitleTextBlock}" Margin="8,8,8,16">OPTIONS</TextBlock>
114115
<TextBox Grid.Column="0" Grid.Row="1" materialDesign:HintAssist.Hint="Setting 1" Text="200"/>
115116
<TextBox Grid.Column="0" Grid.Row="2" materialDesign:HintAssist.Hint="Setting 2" Text="400"/>
116117
<TextBox Grid.Column="0" Grid.Row="3" materialDesign:HintAssist.Hint="Setting 3" Text="600"/>
117-
<CheckBox Grid.Column="1" Grid.Row="1"/>
118-
<CheckBox Grid.Column="1" Grid.Row="2" IsChecked="True"/>
119-
<CheckBox Grid.Column="1" Grid.Row="3"/>
118+
<CheckBox Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom" />
119+
<CheckBox Grid.Column="1" Grid.Row="2" IsChecked="True" VerticalAlignment="Bottom" />
120+
<CheckBox Grid.Column="1" Grid.Row="3" VerticalAlignment="Bottom" />
121+
<ComboBox Grid.Column="0" Grid.Row="4" materialDesign:HintAssist.Hint="Setting 4" materialDesign:HintAssist.IsFloating="True"
122+
Margin="8 8 8 8">
123+
<ComboBoxItem>25%</ComboBoxItem>
124+
<ComboBoxItem>50%</ComboBoxItem>
125+
<ComboBoxItem>75%</ComboBoxItem>
126+
<ComboBoxItem>100%</ComboBoxItem>
127+
<ComboBoxItem>150%</ComboBoxItem>
128+
<ComboBoxItem>200%</ComboBoxItem>
129+
<ComboBoxItem>250%</ComboBoxItem>
130+
<ComboBoxItem>500%</ComboBoxItem>
131+
</ComboBox>
120132
</Grid>
121133

122134
</materialDesign:PopupBox>

MainDemo.Wpf/ProvingGround.xaml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
x:Class="MaterialDesignColors.WpfExample.ProvingGround"
66
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
7+
xmlns:wpfExample="clr-namespace:MaterialDesignColors.WpfExample"
78
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
89
Background="{DynamicResource MaterialDesignPaper}"
910
FontFamily="{StaticResource MaterialDesignFont}"
1011
mc:Ignorable="d"
11-
d:DesignWidth="477" d:DesignHeight="272">
12+
d:DesignWidth="477" d:DesignHeight="272"
13+
d:DataContext="{d:DesignInstance wpfExample:ProvingGroundViewModel, d:IsDesignTimeCreatable=False}">
1214
<UserControl.Resources>
1315
<ResourceDictionary>
1416
<ResourceDictionary.MergedDictionaries>
@@ -21,27 +23,19 @@
2123
</ResourceDictionary>
2224
</UserControl.Resources>
2325

24-
2526
<StackPanel>
26-
<ListBox>
27-
<Expander>
28-
<ListBox ItemsSource="{Binding Items}">
29-
30-
</ListBox>
31-
</Expander>
32-
<Expander>
33-
<ListBox ItemsSource="{Binding Items}">
34-
35-
</ListBox>
36-
</Expander>
37-
<Expander>
38-
<ListBox ItemsSource="{Binding Items}">
39-
40-
</ListBox>
41-
</Expander>
42-
</ListBox>
27+
<materialDesign:ColorZone Mode="PrimaryDark" Padding="8">
28+
<StackPanel>
29+
<materialDesign:TimePicker SelectedTime="{Binding SelectedTime}" HorizontalAlignment="Left" />
30+
<DatePicker HorizontalAlignment="Left" materialDesign:HintAssist.Hint="Some date"/>
31+
<Calendar />
32+
</StackPanel>
33+
</materialDesign:ColorZone>
34+
<StackPanel>
35+
<materialDesign:TimePicker SelectedTime="{Binding SelectedTime}" HorizontalAlignment="Left" />
36+
<DatePicker HorizontalAlignment="Left" materialDesign:HintAssist.Hint="Some date"/>
37+
</StackPanel>
4338

44-
<Button Command="{Binding ClearItems}">Clear</Button>
4539
</StackPanel>
4640

4741
</UserControl>

MainDemo.Wpf/ProvingGround.xaml.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System.Windows.Navigation;
1717
using System.Windows.Shapes;
1818
using MaterialDesignColors.WpfExample.Domain;
19+
using MaterialDesignThemes.Wpf;
1920

2021
namespace MaterialDesignColors.WpfExample
2122
{
@@ -45,12 +46,17 @@ private void ButtonsDemoChip_OnDeleteClick(object sender, RoutedEventArgs e)
4546
{
4647
Console.WriteLine("Chip delete clicked.");
4748
}
49+
50+
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
51+
{
52+
new PaletteHelper().QueryPalette();
53+
}
4854
}
4955

5056
public class ProvingGroundViewModel : INotifyPropertyChanged
5157
{
5258
private string _name;
53-
private readonly ObservableCollection<SelectableViewModel> _items = CreateData();
59+
private DateTime? _selectedTime;
5460
public ICommand ClearItems { get; }
5561

5662
public ProvingGroundViewModel()
@@ -68,9 +74,17 @@ public string Name
6874
}
6975
}
7076

71-
public ObservableCollection<SelectableViewModel> Items
77+
public ObservableCollection<SelectableViewModel> Items { get; } = CreateData();
78+
79+
public DateTime? SelectedTime
7280
{
73-
get { return _items; }
81+
get { return _selectedTime; }
82+
set
83+
{
84+
_selectedTime = value;
85+
System.Diagnostics.Debug.WriteLine(((object)_selectedTime ?? "NULL").ToString());
86+
OnPropertyChanged();
87+
}
7488
}
7589

7690
private static ObservableCollection<SelectableViewModel> CreateData()
@@ -102,9 +116,7 @@ private static ObservableCollection<SelectableViewModel> CreateData()
102116

103117
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
104118
{
105-
if (PropertyChanged != null)
106-
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
107-
//PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
119+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
108120
}
109121
}
110122
}

MainDemo.Wpf/Sliders.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<StackPanel Orientation="Horizontal" Grid.Row="3" Margin="0 16 0 0">
4343
<TextBlock VerticalAlignment="Bottom">Try me</TextBlock>
4444
<Slider Minimum="0" Maximum="100" Style="{StaticResource MaterialDesignDiscreteSlider}"
45+
ToolTip="MaterialDesignDiscreteSlider"
4546
Value="50"
4647
Width="280"
4748
Margin="8 0 0 0"/>

MainDemo.Wpf/TextFields.xaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@
114114
x:Name="PasswordBox"
115115
materialDesign:HintAssist.Hint="Password" />
116116
<TextBox Grid.Row="4" Grid.Column="1" materialDesign:HintAssist.Hint="Floating Hint"
117-
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
118-
Margin="0 2 0 0" />
119-
<ComboBox Grid.Row="4" Grid.Column="3" materialDesign:HintAssist.Hint="OS" Style="{StaticResource MaterialDesignFloatingHintComboBox}"
120-
Margin="0 2 0 0" >
117+
Style="{StaticResource MaterialDesignFloatingHintTextBox}" />
118+
<ComboBox Grid.Row="4" Grid.Column="3" materialDesign:HintAssist.Hint="OS" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
121119
<ComboBoxItem>Andoid</ComboBoxItem>
122120
<ComboBoxItem>iOS</ComboBoxItem>
123121
<ComboBoxItem>Linux</ComboBoxItem>

MaterialDesignColors.Wpf/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@
5454
// You can specify all the values or you can default the Build and Revision Numbers
5555
// by using the '*' as shown below:
5656
// [assembly: AssemblyVersion("1.0.*")]
57-
[assembly: AssemblyVersion("1.1.2")]
58-
[assembly: AssemblyFileVersion("1.1.2")]
57+
[assembly: AssemblyVersion("1.1.3")]
58+
[assembly: AssemblyFileVersion("1.1.3")]

MaterialDesignColors.Wpf/Swatch.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace MaterialDesignColors
99
{
10+
/// <summary>
11+
/// Defines a single colour swatch.
12+
/// </summary>
1013
public class Swatch
1114
{
1215
public Swatch(string name, IEnumerable<Hue> primaryHues, IEnumerable<Hue> accentHues)
@@ -38,5 +41,10 @@ public Swatch(string name, IEnumerable<Hue> primaryHues, IEnumerable<Hue> accent
3841
public IEnumerable<Hue> AccentHues { get; }
3942

4043
public bool IsAccented => AccentHues.Any();
44+
45+
public override string ToString()
46+
{
47+
return Name;
48+
}
4149
}
4250
}

MaterialDesignColors.Wpf/SwatchesProvider.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@
1111

1212
namespace MaterialDesignColors
1313
{
14+
/// <summary>
15+
/// Provides access to all colour swatches. For information regarding Material Design colours see https://www.google.com/design/spec/style/color.html
16+
/// </summary>
1417
public class SwatchesProvider
1518
{
16-
public SwatchesProvider()
19+
/// <summary>
20+
/// Generates an instance reading swatches from the provided assembly, allowing
21+
/// colours outside of the standard material palette to be loaded provided the are stored in the expected XAML format.
22+
/// </summary>
23+
/// <param name="assembly"></param>
24+
public SwatchesProvider(Assembly assembly)
1725
{
18-
var assembly = Assembly.GetExecutingAssembly();
1926
var resourcesName = assembly.GetName().Name + ".g";
2027
var manager = new ResourceManager(resourcesName, assembly);
2128
var resourceSet = manager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
@@ -37,9 +44,14 @@ public SwatchesProvider()
3744
Read(assemblyName, x.SingleOrDefault(y => y.match.Groups["type"].Value == "accent")?.key)
3845
))
3946
.ToList();
40-
4147
}
4248

49+
/// <summary>
50+
/// Creates a new swatch provider based on standard Material Design colors.
51+
/// </summary>
52+
public SwatchesProvider() : this(Assembly.GetExecutingAssembly())
53+
{ }
54+
4355
public IEnumerable<Swatch> Swatches { get; }
4456

4557
private static Swatch CreateSwatch(string name, ResourceDictionary primaryDictionary, ResourceDictionary accentDictionary)

MaterialDesignColors.Wpf/Themes/MaterialDesignColor.Amber.Named.Primary.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<Color x:Key="AmberPrimary600">#ffb300</Color>
1616
<Color x:Key="AmberPrimary600Foreground">#DD000000</Color>
1717
<Color x:Key="AmberPrimary700">#ffa000</Color>
18-
<Color x:Key="AmberPrimary700Foreground">#FF000000</Color>
18+
<Color x:Key="AmberPrimary700Foreground">#DD000000</Color>
1919
<Color x:Key="AmberPrimary800">#ff8f00</Color>
20-
<Color x:Key="AmberPrimary800Foreground">#FF000000</Color>
20+
<Color x:Key="AmberPrimary800Foreground">#DD000000</Color>
2121
<Color x:Key="AmberPrimary900">#ff6f00</Color>
22-
<Color x:Key="AmberPrimary900Foreground">#FF000000</Color>
22+
<Color x:Key="AmberPrimary900Foreground">#DD000000</Color>
2323
</ResourceDictionary>

MaterialDesignColors.Wpf/Themes/MaterialDesignColor.Amber.Named.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<Color x:Key="AmberPrimary600">#ffb300</Color>
1616
<Color x:Key="AmberPrimary600Foreground">#DD000000</Color>
1717
<Color x:Key="AmberPrimary700">#ffa000</Color>
18-
<Color x:Key="AmberPrimary700Foreground">#FF000000</Color>
18+
<Color x:Key="AmberPrimary700Foreground">#DD000000</Color>
1919
<Color x:Key="AmberPrimary800">#ff8f00</Color>
20-
<Color x:Key="AmberPrimary800Foreground">#FF000000</Color>
20+
<Color x:Key="AmberPrimary800Foreground">#DD000000</Color>
2121
<Color x:Key="AmberPrimary900">#ff6f00</Color>
22-
<Color x:Key="AmberPrimary900Foreground">#FF000000</Color>
22+
<Color x:Key="AmberPrimary900Foreground">#DD000000</Color>
2323
<Color x:Key="AmberAccent100">#ffe57f</Color>
2424
<Color x:Key="AmberAccent100Foreground">#DD000000</Color>
2525
<Color x:Key="AmberAccent200">#ffd740</Color>

0 commit comments

Comments
 (0)