Skip to content

Commit 7e73c8e

Browse files
committed
Merge pull request #3 from ButchersBoy/master
update from original repo
2 parents 5f7276d + 70bdc25 commit 7e73c8e

20 files changed

+404
-437
lines changed

MainDemo.Uwp/MainPage.xaml

Lines changed: 1 addition & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -15,108 +15,7 @@
1515
>
1616

1717
<Page.Resources>
18-
<ResourceDictionary>
19-
<Style x:Key="ButtonStyle1" TargetType="Button">
20-
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundBaseLowBrush}"/>
21-
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
22-
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundTransparentBrush}"/>
23-
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}"/>
24-
<Setter Property="Padding" Value="8,4,8,4"/>
25-
<Setter Property="HorizontalAlignment" Value="Left"/>
26-
<Setter Property="VerticalAlignment" Value="Center"/>
27-
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
28-
<Setter Property="FontWeight" Value="Normal"/>
29-
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
30-
<Setter Property="UseSystemFocusVisuals" Value="True"/>
31-
<Setter Property="Template">
32-
<Setter.Value>
33-
<ControlTemplate TargetType="Button">
34-
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
35-
<VisualStateManager.VisualStateGroups>
36-
<VisualStateGroup x:Name="CommonStates">
37-
<VisualState x:Name="Normal">
38-
<Storyboard>
39-
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
40-
</Storyboard>
41-
</VisualState>
42-
<VisualState x:Name="PointerOver">
43-
<Storyboard>
44-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
45-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}"/>
46-
</ObjectAnimationUsingKeyFrames>
47-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
48-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseHighBrush}"/>
49-
</ObjectAnimationUsingKeyFrames>
50-
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
51-
</Storyboard>
52-
</VisualState>
53-
<VisualState x:Name="Pressed">
54-
<Storyboard>
55-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
56-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlBackgroundBaseMediumLowBrush}"/>
57-
</ObjectAnimationUsingKeyFrames>
58-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
59-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
60-
</ObjectAnimationUsingKeyFrames>
61-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
62-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseHighBrush}"/>
63-
</ObjectAnimationUsingKeyFrames>
64-
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
65-
</Storyboard>
66-
</VisualState>
67-
<VisualState x:Name="Disabled">
68-
<Storyboard>
69-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
70-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlBackgroundBaseLowBrush}"/>
71-
</ObjectAnimationUsingKeyFrames>
72-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
73-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/>
74-
</ObjectAnimationUsingKeyFrames>
75-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
76-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledTransparentBrush}"/>
77-
</ObjectAnimationUsingKeyFrames>
78-
</Storyboard>
79-
</VisualState>
80-
</VisualStateGroup>
81-
</VisualStateManager.VisualStateGroups>
82-
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
83-
</Grid>
84-
</ControlTemplate>
85-
</Setter.Value>
86-
</Setter>
87-
</Style>
88-
<Style x:Key="RippleStyle1" TargetType="uwp:Ripple">
89-
<Setter Property="HorizontalAlignment" Value="Stretch" />
90-
<Setter Property="VerticalAlignment" Value="Stretch" />
91-
<Setter Property="Background" Value="Transparent" />
92-
<Setter Property="Feedback" Value="White" />
93-
<Setter Property="Template">
94-
<Setter.Value>
95-
<ControlTemplate TargetType="uwp:Ripple">
96-
<Grid Background="Transparent">
97-
<Canvas IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
98-
<Ellipse x:Name="ClickEllipse" Fill="{TemplateBinding Feedback}" Opacity="1" Width="10" Height="10"
99-
Canvas.Left="20"
100-
Canvas.Top="10"
101-
RenderTransformOrigin=".5,.5">
102-
<Ellipse.RenderTransform>
103-
<TranslateTransform x:Name="TranslateTransform"/>
104-
</Ellipse.RenderTransform>
105-
</Ellipse>
106-
</Canvas>
107-
<ContentPresenter Content="{TemplateBinding Content}"
108-
ContentTemplate="{TemplateBinding ContentTemplate}"
109-
Margin="{TemplateBinding Padding}"
110-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
111-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
112-
</Grid>
113-
114-
</ControlTemplate>
115-
</Setter.Value>
116-
</Setter>
117-
</Style>
118-
119-
18+
<ResourceDictionary>
12019

12120
</ResourceDictionary>
12221
</Page.Resources>

MainDemo.Uwp/project.lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11555,7 +11555,7 @@
1155511555
]
1155611556
},
1155711557
"Microsoft.ApplicationInsights.WindowsApps/1.0.0": {
11558-
"sha512": "NvBQnFeiFd0O1QdBz06UGApD7zn7ztVi7qO18IsM3EjiXRNgfrEBXB+azNm8XqLY8xGFAqh3HAuSd/wHZMe0XA==",
11558+
"sha512": "fNCAjIwvbTV+G0dT14bgM5tptsqeSaKQaCrlq7QknOq1Xdm8ZmgsDYddMgXkvykyKLjWyU6fKuOpj6fsQJy+wQ==",
1155911559
"type": "Package",
1156011560
"files": [
1156111561
"_rels/.rels",

MainDemo.Wpf/Buttons.xaml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<RowDefinition Height="Auto" />
2626
<RowDefinition Height="Auto" />
2727
<RowDefinition Height="Auto" />
28-
<RowDefinition />
29-
<RowDefinition />
30-
<RowDefinition />
31-
<RowDefinition />
32-
<RowDefinition />
33-
<RowDefinition />
34-
<RowDefinition />
35-
<RowDefinition />
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="Auto" />
31+
<RowDefinition Height="Auto" />
32+
<RowDefinition Height="Auto" />
33+
<RowDefinition Height="Auto" />
34+
<RowDefinition Height="Auto" />
35+
<RowDefinition Height="Auto" />
3636
</Grid.RowDefinitions>
3737
<TextBlock>Buttons</TextBlock>
3838
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 24 0 0">
@@ -154,22 +154,26 @@
154154
</StackPanel>
155155
<TextBlock Margin="0 24 0 0" Grid.Row="9">Rating bar</TextBlock>
156156
<StackPanel Grid.Row="10" Margin="0 16 0 0" Orientation="Horizontal">
157-
<wpf:RatingBar x:Name="ratingBar" MaxRating="5" Rating="2">
158-
<wpf:RatingBar.RatingItemTemplate>
159-
<DataTemplate>
160-
<Viewbox Width="21" Height="21">
161-
<Canvas Width="24" Height="24">
162-
<Path Data="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
163-
Fill="{StaticResource PrimaryHueMidBrush}" />
164-
</Canvas>
165-
</Viewbox>
157+
<wpf:RatingBar Value="3" x:Name="BasicRatingBar" />
158+
<TextBlock Text="{Binding ElementName=BasicRatingBar, Path=Value, StringFormat=Rating: {0}}" VerticalAlignment="Top" Margin="10,2,0,0" />
159+
<wpf:RatingBar x:Name="CustomRatingBar" Max="3" Value="2" Margin="24 0 0 0" Orientation="Vertical">
160+
<wpf:RatingBar.ValueItemTemplate>
161+
<DataTemplate DataType="system:Int32">
162+
<Grid>
163+
<Viewbox Width="24" Height="24">
164+
<Canvas Width="24" Height="24">
165+
<Path Data="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"
166+
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Control}, Path=Foreground}" />
167+
</Canvas>
168+
</Viewbox>
169+
<TextBlock Text="{Binding}" HorizontalAlignment="Center" VerticalAlignment="Center"
170+
FontSize="8"
171+
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"/>
172+
</Grid>
166173
</DataTemplate>
167-
</wpf:RatingBar.RatingItemTemplate>
174+
</wpf:RatingBar.ValueItemTemplate>
168175
</wpf:RatingBar>
169-
<TextBlock Text="Rating: " VerticalAlignment="Center" Margin="10,0,0,0" />
170-
<TextBlock x:Name="ratingTextBlock" Text="{Binding Path=Rating, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" />
171-
<wpf:RatingBar MaxRating="7" Rating="5" IsEnabled="False" Margin="20,0,0,0" Width="224" />
172-
<TextBlock Text="disabled" VerticalAlignment="Center" Margin="10,0,0,0" />
176+
<TextBlock Text="{Binding ElementName=CustomRatingBar, Path=Value, StringFormat=Rating: {0}}" VerticalAlignment="Top" Margin="10,2,0,0" />
173177
</StackPanel>
174178
</Grid>
175179
</UserControl>

MainDemo.Wpf/Buttons.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ public partial class Buttons : UserControl
2222
{
2323
public Buttons()
2424
{
25-
InitializeComponent();
26-
27-
ratingTextBlock.DataContext = ratingBar;
25+
InitializeComponent();
2826
}
2927

3028
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)

MainDemo.Wpf/Grids.xaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
<ScrollViewer>
1818
<StackPanel>
1919
<TextBlock>Custom Columns</TextBlock>
20-
<DataGrid Margin="0 8 0 0" ItemsSource="{Binding Items3}" CanUserSortColumns="True" CanUserAddRows="False" AutoGenerateColumns="False">
20+
<DataGrid Margin="0 8 0 0" ItemsSource="{Binding Items3}" CanUserSortColumns="True" CanUserAddRows="False" AutoGenerateColumns="False"
21+
wpf:DataGridAssist.CellPadding="13 8 8 8" wpf:DataGridAssist.ColumnHeaderPadding="8">
2122
<DataGrid.Columns>
2223
<DataGridCheckBoxColumn Binding="{Binding IsSelected}"
2324
ElementStyle="{StaticResource MaterialDesignDataGridCheckBoxColumnStyle}"
@@ -69,6 +70,10 @@
6970
</DataGrid>
7071
<TextBlock Margin="0 24 0 0">Auto Generated Columns</TextBlock>
7172
<DataGrid Margin="0 8 0 0" ItemsSource="{Binding Items3}" CanUserSortColumns="True" CanUserAddRows="False" />
73+
<TextBlock Margin="0 24 0 0">Custom Padding</TextBlock>
74+
<DataGrid Margin="0 8 0 0" ItemsSource="{Binding Items3}" CanUserSortColumns="True" CanUserAddRows="False"
75+
wpf:DataGridAssist.CellPadding="4 2 2 2" wpf:DataGridAssist.ColumnHeaderPadding="4 2 2 2"
76+
/>
7277
</StackPanel>
7378
</ScrollViewer>
7479
</UserControl>

MaterialDesignThemes.Uwp/Ripple.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4-
using System.Linq;
54
using System.Runtime.CompilerServices;
6-
using System.Runtime.InteropServices.WindowsRuntime;
75
using Windows.Devices.Input;
86
using Windows.UI.Xaml;
97
using Windows.UI.Xaml.Controls;
@@ -31,7 +29,7 @@ public Ripple()
3129
private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
3230
{
3331
RippleSize = Math.Max(sizeChangedEventArgs.NewSize.Width, sizeChangedEventArgs.NewSize.Height) * RippleSizeMultiplier;
34-
Clip = new RectangleGeometry() { Rect = new Windows.Foundation.Rect(0, 0, sizeChangedEventArgs.NewSize.Width, sizeChangedEventArgs.NewSize.Height) };
32+
Clip = new RectangleGeometry { Rect = new Windows.Foundation.Rect(0, 0, sizeChangedEventArgs.NewSize.Width, sizeChangedEventArgs.NewSize.Height) };
3533
}
3634

3735
public static readonly DependencyProperty FeedbackProperty = DependencyProperty.Register(

MaterialDesignThemes.Uwp/Themes/Generic.xaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
</DoubleAnimationUsingKeyFrames>
7474
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="ScaleTransform">
7575
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
76-
</DoubleAnimationUsingKeyFrames>
77-
76+
</DoubleAnimationUsingKeyFrames>
7877
</Storyboard>
7978
</VisualState>
8079
</VisualStateGroup>
@@ -88,8 +87,7 @@
8887
RenderTransformOrigin=".5,.5">
8988
<Ellipse.RenderTransform>
9089
<TransformGroup>
91-
<ScaleTransform x:Name="ScaleTransform"
92-
/>
90+
<ScaleTransform x:Name="ScaleTransform" />
9391
<SkewTransform/>
9492
<RotateTransform/>
9593
<TranslateTransform x:Name="TranslateTransform"/>

MaterialDesignThemes.Wpf/Converters/RatingToBoolConverter.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

MaterialDesignThemes.Wpf/DataGridAssist.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,32 @@ public static void SetAutoGeneratedEditingTextStyle(DependencyObject element, St
7878
public static Style GetAutoGeneratedEditingTextStyle(DependencyObject element)
7979
{
8080
return (Style) element.GetValue(AutoGeneratedEditingTextStyleProperty);
81-
}
81+
}
82+
83+
public static readonly DependencyProperty CellPaddingProperty = DependencyProperty.RegisterAttached(
84+
"CellPadding", typeof (Thickness), typeof (DataGridAssist), new FrameworkPropertyMetadata(new Thickness(13, 8, 8, 8), FrameworkPropertyMetadataOptions.Inherits));
85+
86+
public static void SetCellPadding(DependencyObject element, Thickness value)
87+
{
88+
element.SetValue(CellPaddingProperty, value);
89+
}
90+
91+
public static Thickness GetCellPadding(DependencyObject element)
92+
{
93+
return (Thickness) element.GetValue(CellPaddingProperty);
94+
}
95+
96+
public static readonly DependencyProperty ColumnHeaderPaddingProperty = DependencyProperty.RegisterAttached(
97+
"ColumnHeaderPadding", typeof (Thickness), typeof (DataGridAssist), new FrameworkPropertyMetadata(new Thickness(8), FrameworkPropertyMetadataOptions.Inherits));
98+
99+
public static void SetColumnHeaderPadding(DependencyObject element, Thickness value)
100+
{
101+
element.SetValue(ColumnHeaderPaddingProperty, value);
102+
}
103+
104+
public static Thickness GetColumnHeaderPadding(DependencyObject element)
105+
{
106+
return (Thickness) element.GetValue(ColumnHeaderPaddingProperty);
107+
}
82108
}
83109
}

0 commit comments

Comments
 (0)