Skip to content

Commit d29cd62

Browse files
authored
Merge pull request #24 from ButchersBoy/master
update from original repo
2 parents cb72531 + a8888e4 commit d29cd62

Some content is hidden

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

55 files changed

+15018
-12355
lines changed

.github/ISSUE_TEMPLATE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# This is a place for issues. Questions are better asked in the Gitter chat room.
44

5-
# Seriously consider creating and linking to a test repo which takes absolutely minimal setup to illustrate how reproduce the problem. My time is limited and and .Zip files, code snippets and partial examples are often a code snippet. GitHub also provides great communication and code review tools which can be utilised.
5+
# Seriously consider creating and linking to a test repo which takes absolutely minimal setup to illustrate how reproduce the problem.
6+
7+
My time is limited and .Zip files, code snippets and partial examples are often a time sink. GitHub also provides great communication and code review tools which can be utilised.
68

79
# HOW TO POST A GOOD SAMPLE. Follow these guidelines and I will most likely look at the issue sooner:
810

MainDemo.Uwp/MainDemo.Uwp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<AssemblyName>MainDemo.Uwp</AssemblyName>
1212
<DefaultLanguage>en-US</DefaultLanguage>
1313
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
14-
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
15-
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
14+
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
15+
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
1616
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
1717
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
1818
<FileAlignment>512</FileAlignment>

MainDemo.Uwp/MainPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
<Button Margin="8 0 0 0" Width="100" Style="{StaticResource MaterialDesignRaisedDarkButton}">DARK</Button>
3333
<Button Margin="8 0 0 0" Width="100" Style="{StaticResource MaterialDesignRaisedAccentButton}">ACCENT</Button>
3434
</StackPanel>
35-
<ToggleSwitch Style="{StaticResource MaterialDesignToggleSwitch}" />
35+
<ToggleSwitch Style="{StaticResource MaterialDesignToggleSwitch}" />
36+
<CheckBox Style="{StaticResource MaterialDesignCheckBox}">Material Design</CheckBox>
3637
</StackPanel>
3738
</Grid>
3839
</Page>

MainDemo.Uwp/project.lock.json

Lines changed: 6911 additions & 5892 deletions
Large diffs are not rendered by default.

MainDemo.Wpf/Buttons.xaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
88
xmlns:wpfExample="clr-namespace:MaterialDesignColors.WpfExample"
99
mc:Ignorable="d"
10-
d:DesignHeight="400" d:DesignWidth="800">
10+
d:DesignHeight="500" d:DesignWidth="800">
1111
<UserControl.Resources>
1212
<ResourceDictionary>
1313
<ResourceDictionary.MergedDictionaries>
@@ -263,6 +263,17 @@
263263
ToolTip="MaterialDesignSwitchDarkToggleButton" IsChecked="True" />
264264
<ToggleButton Style="{StaticResource MaterialDesignSwitchAccentToggleButton}" VerticalAlignment="Center" Margin="8 0 0 0"
265265
ToolTip="MaterialDesignSwitchAccentToggleButton" IsChecked="True" />
266+
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="8 0 0 0"
267+
ToolTip="MaterialDesignSwitchToggleButton with Content and ToggleButtonAssist.OnContent">
268+
<materialDesign:PackIcon Kind="Pin" RenderTransformOrigin=".5,.5">
269+
<materialDesign:PackIcon.RenderTransform>
270+
<RotateTransform Angle="45" />
271+
</materialDesign:PackIcon.RenderTransform>
272+
</materialDesign:PackIcon>
273+
<materialDesign:ToggleButtonAssist.OnContent>
274+
<materialDesign:PackIcon Kind="Pin"/>
275+
</materialDesign:ToggleButtonAssist.OnContent>
276+
</ToggleButton>
266277
</StackPanel>
267278
<StackPanel Grid.Row="3" Margin="0 16 0 0" Orientation="Horizontal">
268279
<ToggleButton Style="{StaticResource MaterialDesignFlatToggleButton}" ToolTip="MaterialDesignFlatToggleButton">

MainDemo.Wpf/Domain/DemoItem.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4-
using System.Linq;
54
using System.Runtime.CompilerServices;
65
using System.Text;
76
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Markup;
89

910
namespace MaterialDesignColors.WpfExample.Domain
1011
{
@@ -13,24 +14,27 @@ public class DemoItem : INotifyPropertyChanged
1314
private string _name;
1415
private object _content;
1516

17+
public DemoItem(string name, object content, IEnumerable<DocumentationLink> documentation)
18+
{
19+
_name = name;
20+
Content = content;
21+
Documentation = documentation;
22+
}
23+
1624
public string Name
1725
{
1826
get { return _name; }
19-
set
20-
{
21-
this.MutateVerbose(ref _name, value, RaisePropertyChanged());
22-
}
27+
set { this.MutateVerbose(ref _name, value, RaisePropertyChanged()); }
2328
}
2429

2530
public object Content
2631
{
2732
get { return _content; }
28-
set
29-
{
30-
this.MutateVerbose(ref _content, value, RaisePropertyChanged());
31-
}
33+
set { this.MutateVerbose(ref _content, value, RaisePropertyChanged()); }
3234
}
3335

36+
public IEnumerable<DocumentationLink> Documentation { get; }
37+
3438
public event PropertyChangedEventHandler PropertyChanged;
3539

3640
private Action<PropertyChangedEventArgs> RaisePropertyChanged()
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
using System;
2+
using System.Windows;
3+
using System.Windows.Controls;
4+
using System.Windows.Input;
5+
6+
namespace MaterialDesignColors.WpfExample.Domain
7+
{
8+
public class DocumentationLink
9+
{
10+
public DocumentationLink(DocumentationLinkType type, string url) : this(type, url, null)
11+
{
12+
}
13+
14+
public DocumentationLink(DocumentationLinkType type, string url, string label)
15+
{
16+
Label = label ?? type.ToString();
17+
Url = url;
18+
Type = type;
19+
Open = new AnotherCommandImplementation(Execute);
20+
}
21+
22+
public static DocumentationLink WikiLink(string page, string label)
23+
{
24+
return new DocumentationLink(DocumentationLinkType.Wiki,
25+
"https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/wiki/" + page, label);
26+
}
27+
28+
public static DocumentationLink StyleLink(string nameChunk)
29+
{
30+
return new DocumentationLink(
31+
DocumentationLinkType.StyleSource,
32+
$"https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.{nameChunk}.xaml",
33+
nameChunk);
34+
}
35+
36+
public static DocumentationLink ApiLink<TClass>(string subNamespace)
37+
{
38+
var typeName = typeof(TClass).Name;
39+
40+
return new DocumentationLink(
41+
DocumentationLinkType.ControlSource,
42+
$"https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/{subNamespace}/{typeName}.cs",
43+
typeName);
44+
}
45+
46+
47+
public static DocumentationLink ApiLink<TClass>()
48+
{
49+
var typeName = typeof(TClass).Name;
50+
51+
return new DocumentationLink(
52+
DocumentationLinkType.ControlSource,
53+
$"https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/{typeName}.cs",
54+
typeName);
55+
}
56+
57+
public static DocumentationLink DemoPageLink<TDemoPage>()
58+
{
59+
return DemoPageLink<TDemoPage>(null);
60+
}
61+
62+
public static DocumentationLink DemoPageLink<TDemoPage>(string label)
63+
{
64+
var ext = typeof(UserControl).IsAssignableFrom(typeof(TDemoPage))
65+
? "xaml"
66+
: "cs";
67+
68+
return new DocumentationLink(
69+
DocumentationLinkType.DemoPageSource,
70+
$"https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/{typeof(TDemoPage).Name}.{ext}",
71+
label ?? typeof(TDemoPage).Name);
72+
}
73+
74+
public string Label { get; }
75+
76+
public string Url { get; }
77+
78+
public DocumentationLinkType Type { get; }
79+
80+
public ICommand Open { get; }
81+
82+
private void Execute(object o)
83+
{
84+
System.Diagnostics.Process.Start(Url);
85+
}
86+
}
87+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace MaterialDesignColors.WpfExample.Domain
2+
{
3+
public enum DocumentationLinkType
4+
{
5+
Wiki,
6+
DemoPageSource,
7+
ControlSource,
8+
StyleSource,
9+
Video
10+
}
11+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<UserControl x:Class="MaterialDesignDemo.Domain.DocumentationLinks"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
7+
xmlns:domain="clr-namespace:MaterialDesignColors.WpfExample.Domain"
8+
mc:Ignorable="d"
9+
d:DesignHeight="300" d:DesignWidth="300"
10+
d:DataContext="{d:DesignInstance domain:DemoItem, IsDesignTimeCreatable=True }">
11+
<UserControl.Resources>
12+
<ResourceDictionary>
13+
<ResourceDictionary.MergedDictionaries>
14+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
15+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
16+
</ResourceDictionary.MergedDictionaries>
17+
<DataTemplate DataType="{x:Type domain:DocumentationLink}">
18+
<Button x:Name="Root" ToolTip="Wiki Article" ToolTipService.InitialShowDelay="0"
19+
Style="{DynamicResource MaterialDesignFlatButton}"
20+
Command="{Binding Open}">
21+
<StackPanel Orientation="Horizontal">
22+
<materialDesign:PackIcon x:Name="PackIcon" Kind="BookOpenVariant" />
23+
<TextBlock Margin="8 0 0 0" Style="{StaticResource MaterialDesignBody1TextBlock}"
24+
Text="{Binding Label, Mode=OneWay}" />
25+
</StackPanel>
26+
</Button>
27+
<DataTemplate.Triggers>
28+
<DataTrigger Binding="{Binding Type}" Value="DemoPageSource">
29+
<Setter TargetName="PackIcon" Property="Kind" Value="Xml" />
30+
<Setter TargetName="Root" Property="ToolTip" Value="Demo Source" />
31+
</DataTrigger>
32+
<DataTrigger Binding="{Binding Type}" Value="StyleSource">
33+
<Setter TargetName="PackIcon" Property="Kind" Value="Brush" />
34+
<Setter TargetName="Root" Property="ToolTip" Value="Style Source" />
35+
</DataTrigger>
36+
<DataTrigger Binding="{Binding Type}" Value="Video">
37+
<Setter TargetName="PackIcon" Property="Kind" Value="YoutubePlay" />
38+
<Setter TargetName="Root" Property="ToolTip" Value="Video Help" />
39+
</DataTrigger>
40+
<DataTrigger Binding="{Binding Type}" Value="ControlSource">
41+
<Setter TargetName="PackIcon" Property="Kind" Value="CodeBraces" />
42+
<Setter TargetName="Root" Property="ToolTip" Value="Object Source/API" />
43+
</DataTrigger>
44+
</DataTemplate.Triggers>
45+
</DataTemplate>
46+
</ResourceDictionary>
47+
</UserControl.Resources>
48+
<Grid>
49+
<StackPanel Margin="16" Orientation="Horizontal">
50+
<materialDesign:PackIcon Kind="Information" VerticalAlignment="Center" />
51+
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Information Links:</TextBlock>
52+
<ItemsControl Margin="16 0 0 0" ItemsSource="{Binding Documentation}">
53+
<ItemsControl.ItemsPanel>
54+
<ItemsPanelTemplate>
55+
<StackPanel Orientation="Horizontal" />
56+
</ItemsPanelTemplate>
57+
</ItemsControl.ItemsPanel>
58+
<ItemsControl.ItemContainerStyle>
59+
<Style TargetType="ContentPresenter">
60+
<Setter Property="Margin" Value="0 0 32 0"></Setter>
61+
</Style>
62+
</ItemsControl.ItemContainerStyle>
63+
</ItemsControl>
64+
</StackPanel>
65+
<Border BorderBrush="{DynamicResource MaterialDesignDivider}" BorderThickness="0 0 0 1" />
66+
</Grid>
67+
</UserControl>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace MaterialDesignDemo.Domain
17+
{
18+
/// <summary>
19+
/// Interaction logic for DocumentationLinks.xaml
20+
/// </summary>
21+
public partial class DocumentationLinks : UserControl
22+
{
23+
public DocumentationLinks()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)