Skip to content

Commit 84d50f8

Browse files
committed
Merge pull request #71 from spiegelp/master
template for Expander
2 parents 5451701 + c8e0645 commit 84d50f8

File tree

9 files changed

+317
-5
lines changed

9 files changed

+317
-5
lines changed

MainDemo.Wpf/Expander.xaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.Expander"
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+
mc:Ignorable="d"
8+
d:DesignHeight="400" d:DesignWidth="600">
9+
<Grid>
10+
<Grid.ColumnDefinitions>
11+
<ColumnDefinition Width="50*" />
12+
<ColumnDefinition Width="50*" />
13+
</Grid.ColumnDefinitions>
14+
<StackPanel HorizontalAlignment="Stretch" Margin="8" Orientation="Vertical" VerticalAlignment="Stretch">
15+
<Expander IsExpanded="True" HorizontalAlignment="Stretch">
16+
<Expander.Header>
17+
<TextBlock Text="Expander Example 1" />
18+
</Expander.Header>
19+
<Border Background="{StaticResource MaterialDesignBackground}" CornerRadius="5" Padding="5">
20+
<StackPanel Orientation="Vertical">
21+
<TextBlock Text="A short text to proof functionality." />
22+
<TextBlock Margin="0,50,0,0" Text="A short text to proof functionality." />
23+
</StackPanel>
24+
</Border>
25+
</Expander>
26+
<TextBlock Text="Text after the expander." Margin="0,8,0,0" />
27+
</StackPanel>
28+
<StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="8" Orientation="Vertical" VerticalAlignment="Stretch">
29+
<Expander IsExpanded="False" HorizontalAlignment="Stretch">
30+
<Expander.Header>
31+
<TextBlock Text="Expander Example 2" />
32+
</Expander.Header>
33+
<StackPanel Orientation="Vertical" Margin="8">
34+
<TextBlock Text="A short text to proof functionality." />
35+
<TextBlock Margin="0,150,0,0" Text="A short text to proof functionality." />
36+
</StackPanel>
37+
</Expander>
38+
<TextBlock Text="Text after the expander." Margin="0,8,0,0" />
39+
</StackPanel>
40+
</Grid>
41+
</UserControl>

MainDemo.Wpf/Expander.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+
/// Interaktionslogik für Expander.xaml
20+
/// </summary>
21+
public partial class Expander : UserControl
22+
{
23+
public Expander()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

MainDemo.Wpf/MainDemo.Wpf.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
</Compile>
9797
<Compile Include="Domain\SelectableViewModel.cs" />
9898
<Compile Include="Domain\TextFieldsViewModel.cs" />
99+
<Compile Include="Expander.xaml.cs">
100+
<DependentUpon>Expander.xaml</DependentUpon>
101+
</Compile>
99102
<Compile Include="Grids.xaml.cs">
100103
<DependentUpon>Grids.xaml</DependentUpon>
101104
</Compile>
@@ -143,6 +146,10 @@
143146
<SubType>Designer</SubType>
144147
<Generator>MSBuild:Compile</Generator>
145148
</Page>
149+
<Page Include="Expander.xaml">
150+
<SubType>Designer</SubType>
151+
<Generator>MSBuild:Compile</Generator>
152+
</Page>
146153
<Page Include="Dialogs.xaml">
147154
<SubType>Designer</SubType>
148155
<Generator>MSBuild:Compile</Generator>

MainDemo.Wpf/MainWindow.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@
108108
</wpfExample:Grids>
109109
</domain:DemoItem.Content>
110110
</domain:DemoItem>
111+
<domain:DemoItem Name="Expander">
112+
<domain:DemoItem.Content>
113+
<wpfExample:Expander />
114+
</domain:DemoItem.Content>
115+
</domain:DemoItem>
111116
<domain:DemoItem Name="Menus &amp; Tool Bars">
112117
<domain:DemoItem.Content>
113118
<wpfExample:MenusAndToolBars />

MainDemo.Wpf/TextFields.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public partial class TextFields : UserControl
2727
public TextFields()
2828
{
2929
InitializeComponent();
30-
DataContext = new TextFieldsViewModel();
31-
}
30+
DataContext = new TextFieldsViewModel();
31+
}
3232

3333
private void UserControl_Loaded(object sender, RoutedEventArgs e)
3434
{

MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
<SubType>Designer</SubType>
9797
<Generator>MSBuild:Compile</Generator>
9898
</Page>
99+
<Page Include="Themes\MaterialDesignTheme.Expander.xaml">
100+
<SubType>Designer</SubType>
101+
<Generator>MSBuild:Compile</Generator>
102+
</Page>
99103
<Page Include="Themes\MaterialDesignTheme.GridSplitter.xaml">
100104
<SubType>Designer</SubType>
101105
<Generator>MSBuild:Compile</Generator>

MaterialDesignThemes.Wpf/Themes/Generic.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
in your App.xaml
1616
-->
1717
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Card.xaml" />
18-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Clock.xaml" />
18+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Clock.xaml" />
1919
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RatingBar.xaml" />
2020
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TimePicker.xaml" />
2121
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
2222
</ResourceDictionary.MergedDictionaries>
2323

2424
<!-- set up default styles for our custom Material Design in XAML Toolkit controls -->
2525
<Style TargetType="{x:Type local:Clock}" BasedOn="{StaticResource MaterialDesignClock}" />
26-
<Style TargetType="{x:Type local:TimePicker}" BasedOn="{StaticResource MaterialDesignTimePicker}" />
26+
<Style TargetType="{x:Type local:TimePicker}" BasedOn="{StaticResource MaterialDesignTimePicker}" />
2727

2828
<converters:BrushToRadialGradientBrushConverter x:Key="BrushToRadialGradientBrushConverter" />
2929
<converters:DrawerOffsetConverter x:Key="DrawerOffsetConverter" />

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.checkbox.xaml" />
1313
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.combobox.xaml" />
1414
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.xaml" />
15-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DatePicker.xaml" />
15+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DatePicker.xaml" />
16+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Expander.xaml" />
1617
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.GridSplitter.xaml" />
1718
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Label.xaml" />
1819
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.listbox.xaml" />
@@ -40,6 +41,7 @@
4041
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MaterialDesignDataGridRow}" />
4142
<Style TargetType="{x:Type DataGridRowHeader}" BasedOn="{StaticResource MaterialDesignDataGridRowHeader}" />
4243
<Style TargetType="{x:Type DatePicker}" BasedOn="{StaticResource MaterialDesignDatePicker}" />
44+
<Style TargetType="{x:Type Expander}" BasedOn="{StaticResource MaterialDesignExpander}" />
4345
<Style TargetType="{x:Type GridSplitter}" BasedOn="{StaticResource MaterialDesignGridSplitter}" />
4446
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource MaterialDesignLabel}" />
4547
<Style TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}" />

0 commit comments

Comments
 (0)