-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fca1e92
commit 58a260f
Showing
9 changed files
with
184 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<UserControl x:Class="MaterialDesignColors.WpfExample.Shadows" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:MaterialDesignColors.WpfExample" | ||
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" d:DesignWidth="300"> | ||
<StackPanel Margin="0 8 0 0"> | ||
<TextBlock>Raised controls have default shadows set, but the shadows can be overriden.</TextBlock> | ||
<StackPanel Orientation="Horizontal" Margin="0 32 0 0"> | ||
<Button Style="{DynamicResource MaterialDesignRaisedButton}" | ||
>DEPTH 1</Button> | ||
<Button Style="{DynamicResource MaterialDesignRaisedButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth2" | ||
>DEPTH 2</Button> | ||
<Button Style="{DynamicResource MaterialDesignRaisedButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth3" | ||
>DEPTH 3</Button> | ||
<Button Style="{DynamicResource MaterialDesignRaisedButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth4" | ||
>DEPTH 4</Button> | ||
<Button Style="{DynamicResource MaterialDesignRaisedButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth5" | ||
>DEPTH 5</Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="0 32 0 0"> | ||
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}" | ||
wpf:ShadowAssist.ShadowDepth="Depth1" | ||
>1</Button> | ||
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth2" | ||
>2</Button> | ||
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}" | ||
Margin="16 0 0 0" | ||
>3</Button> | ||
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth4" | ||
>4</Button> | ||
<Button Style="{DynamicResource MaterialDesignFloatingActionButton}" | ||
Margin="16 0 0 0" | ||
wpf:ShadowAssist.ShadowDepth="Depth5" | ||
>5</Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="0 32 0 0"> | ||
<wpf:Card wpf:ShadowAssist.ShadowDepth="Depth1" Padding="32">DEPTH 1</wpf:Card> | ||
<wpf:Card wpf:ShadowAssist.ShadowDepth="Depth2" Margin="16 0 0 0" Padding="32">DEPTH 2</wpf:Card> | ||
<wpf:Card wpf:ShadowAssist.ShadowDepth="Depth3" Margin="16 0 0 0" Padding="32">DEPTH 3</wpf:Card> | ||
<wpf:Card wpf:ShadowAssist.ShadowDepth="Depth4" Margin="16 0 0 0" Padding="32">DEPTH 4</wpf:Card> | ||
<wpf:Card wpf:ShadowAssist.ShadowDepth="Depth5" Margin="16 0 0 0" Padding="32">DEPTH 5</wpf:Card> | ||
</StackPanel> | ||
|
||
</StackPanel> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace MaterialDesignColors.WpfExample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Shadows.xaml | ||
/// </summary> | ||
public partial class Shadows : UserControl | ||
{ | ||
public Shadows() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace MaterialDesignThemes.Wpf.Converters | ||
{ | ||
public class ShadowConverter : IValueConverter | ||
{ | ||
private static readonly IDictionary<ShadowDepth, object> ShadowsDictionary; | ||
public static readonly ShadowConverter Instance = new ShadowConverter(); | ||
|
||
static ShadowConverter() | ||
{ | ||
var resourceDictionary = new ResourceDictionary { Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml", UriKind.Absolute) }; | ||
|
||
ShadowsDictionary = new Dictionary<ShadowDepth, object> | ||
{ | ||
{ ShadowDepth.Depth1, resourceDictionary["MaterialDesignShadowDepth1"] }, | ||
{ ShadowDepth.Depth2, resourceDictionary["MaterialDesignShadowDepth2"] }, | ||
{ ShadowDepth.Depth3, resourceDictionary["MaterialDesignShadowDepth3"] }, | ||
{ ShadowDepth.Depth4, resourceDictionary["MaterialDesignShadowDepth4"] }, | ||
{ ShadowDepth.Depth5, resourceDictionary["MaterialDesignShadowDepth5"] }, | ||
}; | ||
} | ||
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return ShadowsDictionary[(ShadowDepth) value]; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Windows; | ||
|
||
namespace MaterialDesignThemes.Wpf | ||
{ | ||
public enum ShadowDepth | ||
{ | ||
Depth1, | ||
Depth2, | ||
Depth3, | ||
Depth4, | ||
Depth5 | ||
} | ||
|
||
public static class ShadowAssist | ||
{ | ||
public static readonly DependencyProperty ShadowDepthProperty = DependencyProperty.RegisterAttached( | ||
"ShadowDepth", typeof (ShadowDepth), typeof (ShadowAssist), new PropertyMetadata(default(ShadowDepth))); | ||
|
||
public static void SetShadowDepth(DependencyObject element, ShadowDepth value) | ||
{ | ||
element.SetValue(ShadowDepthProperty, value); | ||
} | ||
|
||
public static ShadowDepth GetShadowDepth(DependencyObject element) | ||
{ | ||
return (ShadowDepth) element.GetValue(ShadowDepthProperty); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters