Skip to content

Commit b540a43

Browse files
committed
Merge branch 'FishNChips' of https://github.com/ButchersBoy/MaterialDesignInXamlToolkit into FishNChips
2 parents f945917 + d5d99b6 commit b540a43

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-0
lines changed

MainDemo.Wpf/Chips.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.Chips"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
8+
mc:Ignorable="d"
9+
d:DesignHeight="300" d:DesignWidth="300">
10+
<Grid Margin="32">
11+
<materialDesign:Chip Text="Butcher's Boy" />
12+
</Grid>
13+
</UserControl>

MainDemo.Wpf/Chips.xaml.cs

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 MaterialDesignColors.WpfExample
17+
{
18+
/// <summary>
19+
/// Interaction logic for Chips.xaml
20+
/// </summary>
21+
public partial class Chips : UserControl
22+
{
23+
public Chips()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

MainDemo.Wpf/MaterialDesignDemo.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
<Compile Include="Cards.xaml.cs">
7777
<DependentUpon>Cards.xaml</DependentUpon>
7878
</Compile>
79+
<Compile Include="Chips.xaml.cs">
80+
<DependentUpon>Chips.xaml</DependentUpon>
81+
</Compile>
7982
<Compile Include="ColorZones.xaml.cs">
8083
<DependentUpon>ColorZones.xaml</DependentUpon>
8184
</Compile>
@@ -192,6 +195,10 @@
192195
<SubType>Designer</SubType>
193196
<Generator>MSBuild:Compile</Generator>
194197
</Page>
198+
<Page Include="Chips.xaml">
199+
<SubType>Designer</SubType>
200+
<Generator>MSBuild:Compile</Generator>
201+
</Page>
195202
<Page Include="ColorZones.xaml">
196203
<SubType>Designer</SubType>
197204
<Generator>MSBuild:Compile</Generator>

MaterialDesignThemes.Wpf/Chip.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
9+
namespace MaterialDesignThemes.Wpf
10+
{
11+
public class Chip : Control
12+
{
13+
static Chip()
14+
{
15+
DefaultStyleKeyProperty.OverrideMetadata(typeof(Chip), new FrameworkPropertyMetadata(typeof(Chip)));
16+
}
17+
18+
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
19+
"Icon", typeof (object), typeof (Chip), new PropertyMetadata(default(object)));
20+
21+
public object Icon
22+
{
23+
get { return (object) GetValue(IconProperty); }
24+
set { SetValue(IconProperty, value); }
25+
}
26+
27+
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
28+
"Text", typeof (string), typeof (Chip), new PropertyMetadata(default(string)));
29+
30+
public string Text
31+
{
32+
get { return (string) GetValue(TextProperty); }
33+
set { SetValue(TextProperty, value); }
34+
}
35+
36+
public static readonly DependencyProperty IsDeletableProperty = DependencyProperty.Register(
37+
"IsDeletable", typeof (bool), typeof (Chip), new PropertyMetadata(default(bool)));
38+
39+
public bool IsDeletable
40+
{
41+
get { return (bool) GetValue(IsDeletableProperty); }
42+
set { SetValue(IsDeletableProperty, value); }
43+
}
44+
}
45+
}

MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
</ItemGroup>
215215
<ItemGroup>
216216
<Compile Include="Card.cs" />
217+
<Compile Include="Chip.cs" />
217218
<Compile Include="Clock.cs" />
218219
<Compile Include="ClockChoiceMadeEventArgs.cs" />
219220
<Compile Include="ClockItemButton.cs" />

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,27 @@
394394
</Setter.Value>
395395
</Setter>
396396
</Style>
397+
398+
<Style TargetType="{x:Type local:Chip}">
399+
<Setter Property="Height" Value="32" />
400+
<Setter Property="HorizontalAlignment" Value="Left" />
401+
<Setter Property="Template">
402+
<Setter.Value>
403+
<ControlTemplate TargetType="{x:Type local:Chip}">
404+
<Grid>
405+
<Border CornerRadius="16" Background="#12000000"></Border>
406+
<TextBlock Text="{TemplateBinding Text}"
407+
VerticalAlignment="Center"
408+
Margin="12 0 12 0" />
409+
<!-- button Bg #89000000 -->
410+
<!--
411+
<Button></Button>
412+
-->
413+
</Grid>
414+
</ControlTemplate>
415+
</Setter.Value>
416+
</Setter>
417+
</Style>
397418

398419
<Style TargetType="{x:Type local:ColorZone}">
399420
<Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />

0 commit comments

Comments
 (0)