Skip to content

Commit cfe56d1

Browse files
committed
major re-work of demo app
1 parent a218188 commit cfe56d1

17 files changed

+386
-341
lines changed

MaterialDesignColors.WpfExample/Buttons.xaml

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,63 +19,13 @@
1919
</ResourceDictionary.MergedDictionaries>
2020
</ResourceDictionary>
2121
</UserControl.Resources>
22-
<Grid Margin="8 8 8 8">
23-
<Grid.ColumnDefinitions>
24-
<ColumnDefinition Width="3.0001*" />
25-
<ColumnDefinition Width="Auto" />
26-
<ColumnDefinition Width="1*" />
27-
</Grid.ColumnDefinitions>
22+
<Grid>
2823
<Grid.RowDefinitions>
29-
<RowDefinition Height="*" />
3024
<RowDefinition Height="Auto" />
3125
<RowDefinition Height="Auto" />
3226
<RowDefinition Height="Auto" />
3327
</Grid.RowDefinitions>
34-
<ListBox Style="{StaticResource MaterialDesignCardsListBox}">
35-
<ItemsControl.ItemTemplate>
36-
<DataTemplate DataType="{x:Type system:DateTime}">
37-
<Grid Height="80">
38-
<Grid.ColumnDefinitions>
39-
<ColumnDefinition Width="60" />
40-
<ColumnDefinition Width="140" />
41-
</Grid.ColumnDefinitions>
42-
<Border Background="{DynamicResource PrimaryHueLightBrush}" TextBlock.Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
43-
CornerRadius="2 0 0 2"
44-
Padding="8">
45-
<TextBlock Text="{Binding StringFormat=yyy}" />
46-
</Border>
47-
<StackPanel Margin="8" Grid.Column="1" HorizontalAlignment="Right">
48-
<TextBlock Text="{Binding StringFormat=m}" FontWeight="Bold" />
49-
<TextBlock Text="{Binding StringFormat=T}" />
50-
</StackPanel>
51-
<Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
52-
Grid.Column="1" Margin="-20 0 0 0" HorizontalAlignment="Left">
53-
<Viewbox Width="24" Height="24">
54-
<Canvas Width="24" Height="24">
55-
<Path Data="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" Fill="Black" />
56-
</Canvas>
57-
</Viewbox>
58-
</Button>
59-
</Grid>
60-
</DataTemplate>
61-
</ItemsControl.ItemTemplate>
62-
<ItemsControl.ItemsPanel>
63-
<ItemsPanelTemplate>
64-
<WrapPanel />
65-
</ItemsPanelTemplate>
66-
</ItemsControl.ItemsPanel>
67-
<system:DateTime>2011-01-01 12:31:00</system:DateTime>
68-
<system:DateTime>2012-06-30 12:31:00</system:DateTime>
69-
<system:DateTime>2013-12-12 12:31:00</system:DateTime>
70-
<system:DateTime>2014-11-17 12:31:00</system:DateTime>
71-
<system:DateTime>1970-01-01 12:31:00</system:DateTime>
72-
<system:DateTime>1971-06-30 12:31:00</system:DateTime>
73-
<system:DateTime>1972-12-12 12:31:00</system:DateTime>
74-
<system:DateTime>1973-11-17 12:31:00</system:DateTime>
75-
</ListBox>
76-
<GridSplitter Grid.Column="1" Grid.Row="0" ResizeBehavior="PreviousAndNext" ResizeDirection="Columns" Width="4" />
77-
<wpfExample:Palette Grid.Row="0" Grid.Column="2" Margin="8 0 0 0"/>
78-
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" Margin="0 8 0 0">
28+
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" Margin="0 8 0 0">
7929
<Button Style="{StaticResource MaterialDesignFloatingActionLightButton}"
8030
Margin="0 0 8 0" HorizontalAlignment="Left"
8131
ToolTip="X">
@@ -125,7 +75,8 @@
12575
ToolTip="Resource name: MaterialDesignRaisedAccentButton">
12676
ACCENT
12777
</Button>
128-
</StackPanel><StackPanel Grid.Row="2" Grid.Column="0" Margin="0 8 0 0" Grid.ColumnSpan="3" Orientation="Horizontal">
78+
</StackPanel>
79+
<StackPanel Grid.Row="1" Grid.Column="0" Margin="0 8 0 0" Grid.ColumnSpan="3" Orientation="Horizontal">
12980
<ToggleButton Content="C" Margin="0 0 8 8" Style="{StaticResource MaterialDesignActionLightToggleButton}" IsChecked="True" />
13081
<ToggleButton Content="H" Margin="0 0 8 8" Style="{StaticResource MaterialDesignActionToggleButton}"/>
13182
<!-- checkbox style same as toggle button -->
@@ -150,7 +101,7 @@
150101
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="0 0 8 8" />
151102
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="0 0 8 8" IsChecked="True" />
152103
</StackPanel>
153-
<DockPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" Margin="0 8 0 0">
104+
<DockPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Margin="0 8 0 0">
154105
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"
155106
HorizontalAlignment="Right">
156107
<Button Style="{StaticResource MaterialDesignFlatButton}" Click="ButtonBase_OnClick">ACCEPT</Button>
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
<Window x:Class="MaterialDesignColors.WpfExample.CardsWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
5-
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
6-
Background="{DynamicResource MaterialDesignPaper}"
7-
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
8-
Title="Cards" Height="320" Width="400">
9-
<Window.Resources>
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.Cards"
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:local="clr-namespace:MaterialDesignColors.WpfExample"
7+
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
8+
mc:Ignorable="d"
9+
d:DesignHeight="300" d:DesignWidth="300">
10+
<UserControl.Resources>
1011
<ResourceDictionary>
1112
<ResourceDictionary.MergedDictionaries>
1213
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
1314
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.CheckBox.xaml" />
1415
</ResourceDictionary.MergedDictionaries>
1516
</ResourceDictionary>
16-
17-
</Window.Resources>
17+
</UserControl.Resources>
1818
<WrapPanel Margin="0 0 8 8" ItemWidth="200" Orientation="Vertical">
1919
<wpf:Card Margin="4 4 0 0">
2020
<Grid>
2121
<Grid.RowDefinitions>
2222
<RowDefinition Height="140" />
2323
<RowDefinition Height="*" />
2424
<RowDefinition Height="Auto" />
25-
</Grid.RowDefinitions>
26-
<Image Source="Resources/Chartridge046_small.jpg" Height="140" Width="196" Stretch="UniformToFill" />
25+
</Grid.RowDefinitions>
26+
<Image Source="Resources/Chartridge046_small.jpg" Height="140" Width="196" Stretch="UniformToFill" />
2727
<Button Grid.Row="1" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" HorizontalAlignment="Right" Margin="0 -68 16 0">
2828
<Viewbox Width="16" Height="16">
2929
<Canvas Width="24" Height="24">
3030
<Path Data="M5,20.5A3.5,3.5 0 0,1 1.5,17A3.5,3.5 0 0,1 5,13.5A3.5,3.5 0 0,1 8.5,17A3.5,3.5 0 0,1 5,20.5M5,12A5,5 0 0,0 0,17A5,5 0 0,0 5,22A5,5 0 0,0 10,17A5,5 0 0,0 5,12M14.8,10H19V8.2H15.8L13.86,4.93C13.57,4.43 13,4.1 12.4,4.1C11.93,4.1 11.5,4.29 11.2,4.6L7.5,8.29C7.19,8.6 7,9 7,9.5C7,10.13 7.33,10.66 7.85,10.97L11.2,13V18H13V11.5L10.75,9.85L13.07,7.5M19,20.5A3.5,3.5 0 0,1 15.5,17A3.5,3.5 0 0,1 19,13.5A3.5,3.5 0 0,1 22.5,17A3.5,3.5 0 0,1 19,20.5M19,12A5,5 0 0,0 14,17A5,5 0 0,0 19,22A5,5 0 0,0 24,17A5,5 0 0,0 19,12M16,4.8C17,4.8 17.8,4 17.8,3C17.8,2 17,1.2 16,1.2C15,1.2 14.2,2 14.2,3C14.2,4 15,4.8 16,4.8Z"
3131
Fill="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}}, Path=Foreground}" />
3232
</Canvas>
33-
</Viewbox>
33+
</Viewbox>
3434
</Button>
3535
<StackPanel Grid.Row="1" Margin="8 24 8 0" >
3636
<TextBlock FontWeight="Bold">Cycling</TextBlock>
37-
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center">A great way to keep fit and forget about the constant grind of IT.</TextBlock>
38-
</StackPanel>
37+
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center">A great way to keep fit and forget about the constant grind of IT.</TextBlock>
38+
</StackPanel>
3939
<StackPanel HorizontalAlignment="Right" Grid.Row="2" Orientation="Horizontal" Margin="8">
4040
<Button Style="{StaticResource MaterialDesignToolButton}" Width="30" Padding="2 0 2 0">
4141
<Viewbox Width="16" Height="16">
@@ -54,8 +54,8 @@
5454
</Viewbox>
5555
</Button>
5656
</StackPanel>
57-
</Grid>
58-
</wpf:Card>
57+
</Grid>
58+
</wpf:Card>
5959
<wpf:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueLightBrush}"
6060
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
6161
Padding="8">
@@ -65,16 +65,16 @@
6565
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
6666
Padding="8">
6767
<StackPanel>
68-
<TextBlock FontSize="16">Notes</TextBlock>
68+
<TextBlock FontSize="16">Notes</TextBlock>
6969
<CheckBox Margin="0 4 0 0" Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Do something good</CheckBox>
7070
<CheckBox Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Take a breather</CheckBox>
7171
<CheckBox Style="{StaticResource MaterialDesignUserForegroundCheckBox}">And go create</CheckBox>
72-
</StackPanel>
72+
</StackPanel>
7373
</wpf:Card>
7474
<wpf:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueDarkBrush}"
7575
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
7676
Padding="8" UniformCornerRadius="5">
7777
<TextBlock>You can adjust the corner radius</TextBlock>
7878
</wpf:Card>
7979
</WrapPanel>
80-
</Window>
80+
</UserControl>

MaterialDesignColors.WpfExample/CardsWindow.xaml.cs renamed to MaterialDesignColors.WpfExample/Cards.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010
using System.Windows.Input;
1111
using System.Windows.Media;
1212
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
1314
using System.Windows.Shapes;
1415

1516
namespace MaterialDesignColors.WpfExample
1617
{
1718
/// <summary>
1819
/// Interaction logic for Cards.xaml
1920
/// </summary>
20-
public partial class CardsWindow : Window
21+
public partial class Cards : UserControl
2122
{
22-
public CardsWindow()
23+
public Cards()
2324
{
2425
InitializeComponent();
2526
}

MaterialDesignColors.WpfExample/ColorZoneWindow.xaml renamed to MaterialDesignColors.WpfExample/ColorZones.xaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
<Window x:Class="MaterialDesignColors.WpfExample.ColorZoneWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:local="clr-namespace:MaterialDesignColors.WpfExample"
7-
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
8-
mc:Ignorable="d"
9-
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
10-
TextElement.FontWeight="Medium"
11-
TextElement.FontSize="14"
12-
Background="{DynamicResource MaterialDesignPaper}"
13-
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
14-
Title="Colour Zones" Height="600" Width="800">
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.ColorZones"
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:local="clr-namespace:MaterialDesignColors.WpfExample"
7+
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
8+
mc:Ignorable="d"
9+
d:DesignHeight="300" d:DesignWidth="300">
1510
<ScrollViewer>
1611
<StackPanel Margin="16">
1712
<TextBlock FontSize="16">Colour Zones</TextBlock>
@@ -42,7 +37,7 @@
4237
<TextBlock Margin="0 16 0 0" FontSize="10">Use primary mid colours, and nest colour zones!</TextBlock>
4338
<wpf:ColorZone Mode="PrimaryMid" Padding="16">
4439
<StackPanel Orientation="Horizontal">
45-
<ToggleButton Style="{DynamicResource MaterialDesignHamburgerToggleButton}" />
40+
<ToggleButton Style="{DynamicResource MaterialDesignHamburgerToggleButton}" />
4641
<wpf:ColorZone Mode="Standard" Padding="8 4 8 4" CornerRadius="2" Panel.ZIndex="1"
4742
Margin="16 0 0 0"
4843
Effect="{DynamicResource MaterialDesignShadowDepth1}">
@@ -96,4 +91,5 @@
9691
</wpf:ColorZone>
9792
</StackPanel>
9893
</ScrollViewer>
99-
</Window>
94+
95+
</UserControl>

MaterialDesignColors.WpfExample/PaletteSelectorWindow.xaml.cs renamed to MaterialDesignColors.WpfExample/ColorZones.xaml.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010
using System.Windows.Input;
1111
using System.Windows.Media;
1212
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
1314
using System.Windows.Shapes;
1415

1516
namespace MaterialDesignColors.WpfExample
1617
{
1718
/// <summary>
18-
/// Interaction logic for PaletteSelectorWindow.xaml
19+
/// Interaction logic for ColorZones.xaml
1920
/// </summary>
20-
public partial class PaletteSelectorWindow : Window
21+
public partial class ColorZones : UserControl
2122
{
22-
public PaletteSelectorWindow()
23+
public ColorZones()
2324
{
2425
InitializeComponent();
2526
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MaterialDesignColors.WpfExample.Domain
8+
{
9+
public class DemoItem
10+
{
11+
public string Name { get; set; }
12+
13+
public object Content { get; set; }
14+
}
15+
}

0 commit comments

Comments
 (0)