Skip to content

Commit 89c77bc

Browse files
committed
list box improvements
1 parent ff35b5f commit 89c77bc

File tree

12 files changed

+156
-104
lines changed

12 files changed

+156
-104
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 55 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
</ResourceDictionary.MergedDictionaries>
2020
</ResourceDictionary>
2121
</UserControl.Resources>
22-
<Grid>
22+
<Grid VerticalAlignment="Top">
2323
<Grid.RowDefinitions>
2424
<RowDefinition Height="Auto" />
2525
<RowDefinition Height="Auto" />
2626
<RowDefinition Height="Auto" />
27+
<RowDefinition />
28+
<RowDefinition />
29+
<RowDefinition />
30+
<RowDefinition />
31+
<RowDefinition />
32+
<RowDefinition />
2733
</Grid.RowDefinitions>
28-
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" Margin="0 8 0 0">
34+
<TextBlock>Buttons</TextBlock>
35+
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 24 0 0">
2936
<Button Style="{StaticResource MaterialDesignFloatingActionLightButton}"
3037
Margin="0 0 8 0" HorizontalAlignment="Left"
3138
ToolTip="X">
@@ -59,24 +66,31 @@
5966
</Canvas>
6067
</Viewbox>
6168
</Button>
62-
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 0 8 0" Width="88"
69+
</StackPanel>
70+
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 16 0 0">
71+
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 0 8 0" Width="88"
6372
ToolTip="Resource name: MaterialDesignRaisedLightButton">
6473
LIGHT
6574
</Button>
66-
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 0 8 0" Width="88"
75+
<Button Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 0 8 0" Width="88"
6776
ToolTip="Resource name: MaterialDesignRaisedButton">
6877
MID
6978
</Button>
70-
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignRaisedDarkButton}" Margin="0 0 8 0" Width="88"
79+
<Button Style="{StaticResource MaterialDesignRaisedDarkButton}" Margin="0 0 8 0" Width="88"
7180
ToolTip="Resource name: MaterialDesignRaisedLightDarkButton">
7281
DARK
7382
</Button>
74-
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignRaisedAccentButton}" Margin="0 0 8 0" Width="88"
83+
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}" Margin="0 0 8 0" Width="88"
7584
ToolTip="Resource name: MaterialDesignRaisedAccentButton">
7685
ACCENT
7786
</Button>
7887
</StackPanel>
79-
<StackPanel Grid.Row="1" Grid.Column="0" Margin="0 8 0 0" Grid.ColumnSpan="3" Orientation="Horizontal">
88+
<StackPanel Grid.Row="3" Margin="256 16 0 0" Orientation="Horizontal">
89+
<Button Style="{StaticResource MaterialDesignFlatButton}" Click="ButtonBase_OnClick">ACCEPT</Button>
90+
<Button Style="{StaticResource MaterialDesignFlatButton}">CANCEL</Button>
91+
</StackPanel>
92+
<TextBlock Margin="0 24 0 0" Grid.Row="4">Toggles</TextBlock>
93+
<StackPanel Grid.Row="5" Margin="0 24 0 0" Orientation="Horizontal">
8094
<ToggleButton Content="C" Margin="0 0 8 8" Style="{StaticResource MaterialDesignActionLightToggleButton}" IsChecked="True" />
8195
<ToggleButton Content="H" Margin="0 0 8 8" Style="{StaticResource MaterialDesignActionToggleButton}"/>
8296
<!-- checkbox style same as toggle button -->
@@ -86,6 +100,8 @@
86100
<ToggleButton Margin="0 0 8 8" Style="{StaticResource MaterialDesignActionToggleButton}">
87101
<Image Source="Resources/ProfilePic.jpg"></Image>
88102
</ToggleButton>
103+
</StackPanel>
104+
<StackPanel Grid.Row="6" Margin="0 16 0 0" Orientation="Horizontal">
89105
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" Margin="0 0 8 8" VerticalAlignment="Center" IsChecked="True">
90106
Radio
91107
</RadioButton>
@@ -98,45 +114,40 @@
98114
<CheckBox Style="{StaticResource MaterialDesignCheckBox}" Margin="0 0 8 8" VerticalAlignment="Center" IsChecked="True">
99115
Mate
100116
</CheckBox>
117+
</StackPanel>
118+
<StackPanel Grid.Row="7" Margin="0 16 0 0" Orientation="Horizontal">
101119
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="0 0 8 8" />
102120
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Center" Margin="0 0 8 8" IsChecked="True" />
103121
</StackPanel>
104-
<DockPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Margin="0 8 0 0">
105-
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"
106-
HorizontalAlignment="Right">
107-
<Button Style="{StaticResource MaterialDesignFlatButton}" Click="ButtonBase_OnClick">ACCEPT</Button>
108-
<Button Style="{StaticResource MaterialDesignFlatButton}">CANCEL</Button>
109-
</StackPanel>
110-
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
111-
<ToggleButton Style="{StaticResource MaterialDesignFlatToggleButton}">
112-
<Viewbox Width="21" Height="21">
113-
<Canvas Width="24" Height="24">
114-
<Path Data="M16.5,6V17.5A4,4 0 0,1 12.5,21.5A4,4 0 0,1 8.5,17.5V5A2.5,2.5 0 0,1 11,2.5A2.5,2.5 0 0,1 13.5,5V15.5A1,1 0 0,1 12.5,16.5A1,1 0 0,1 11.5,15.5V6H10V15.5A2.5,2.5 0 0,0 12.5,18A2.5,2.5 0 0,0 15,15.5V5A4,4 0 0,0 11,1A4,4 0 0,0 7,5V17.5A5.5,5.5 0 0,0 12.5,23A5.5,5.5 0 0,0 18,17.5V6H16.5Z"
115-
StrokeThickness="4"
116-
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
117-
</Canvas>
118-
</Viewbox>
119-
</ToggleButton>
120-
<ToggleButton Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
121-
Margin="8 0 0 0"
122-
IsChecked="True">
123-
<Viewbox Width="21" Height="21">
124-
<Canvas Width="24" Height="24">
125-
<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"
126-
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
127-
</Canvas>
128-
</Viewbox>
129-
</ToggleButton>
130-
<ToggleButton Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
131-
IsEnabled="False" Margin="8 0 0 0" >
132-
<Viewbox Width="21" Height="21">
133-
<Canvas Width="24" Height="24">
134-
<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"
135-
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
136-
</Canvas>
137-
</Viewbox>
138-
</ToggleButton>
139-
</StackPanel>
140-
</DockPanel>
122+
<StackPanel Grid.Row="8" Margin="0 16 0 0" Orientation="Horizontal">
123+
<ToggleButton Style="{StaticResource MaterialDesignFlatToggleButton}">
124+
<Viewbox Width="21" Height="21">
125+
<Canvas Width="24" Height="24">
126+
<Path Data="M16.5,6V17.5A4,4 0 0,1 12.5,21.5A4,4 0 0,1 8.5,17.5V5A2.5,2.5 0 0,1 11,2.5A2.5,2.5 0 0,1 13.5,5V15.5A1,1 0 0,1 12.5,16.5A1,1 0 0,1 11.5,15.5V6H10V15.5A2.5,2.5 0 0,0 12.5,18A2.5,2.5 0 0,0 15,15.5V5A4,4 0 0,0 11,1A4,4 0 0,0 7,5V17.5A5.5,5.5 0 0,0 12.5,23A5.5,5.5 0 0,0 18,17.5V6H16.5Z"
127+
StrokeThickness="4"
128+
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
129+
</Canvas>
130+
</Viewbox>
131+
</ToggleButton>
132+
<ToggleButton Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
133+
Margin="8 0 0 0"
134+
IsChecked="True">
135+
<Viewbox Width="21" Height="21">
136+
<Canvas Width="24" Height="24">
137+
<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"
138+
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
139+
</Canvas>
140+
</Viewbox>
141+
</ToggleButton>
142+
<ToggleButton Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
143+
IsEnabled="False" Margin="8 0 0 0">
144+
<Viewbox Width="21" Height="21">
145+
<Canvas Width="24" Height="24">
146+
<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"
147+
Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}, Path=Foreground}" />
148+
</Canvas>
149+
</Viewbox>
150+
</ToggleButton>
151+
</StackPanel>
141152
</Grid>
142153
</UserControl>

MainDemo.Wpf/Cards.xaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ResourceDictionary.MergedDictionaries>
1616
</ResourceDictionary>
1717
</UserControl.Resources>
18-
<WrapPanel Margin="0 0 8 8" ItemWidth="200" Orientation="Vertical">
18+
<WrapPanel Margin="0 0 8 8" ItemWidth="200">
1919
<wpf:Card Margin="4 4 0 0">
2020
<Grid>
2121
<Grid.RowDefinitions>
@@ -24,7 +24,9 @@
2424
<RowDefinition Height="Auto" />
2525
</Grid.RowDefinitions>
2626
<Image Source="Resources/Chartridge046_small.jpg" Height="140" Width="196" Stretch="UniformToFill" />
27-
<Button Grid.Row="1" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" HorizontalAlignment="Right" Margin="0 -68 16 0">
27+
<Button Grid.Row="0" Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
28+
HorizontalAlignment="Right" VerticalAlignment="Bottom"
29+
Margin="0 0 16 -20">
2830
<Viewbox Width="16" Height="16">
2931
<Canvas Width="24" Height="24">
3032
<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"
@@ -73,8 +75,8 @@
7375
</wpf:Card>
7476
<wpf:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueDarkBrush}"
7577
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
76-
Padding="8" UniformCornerRadius="5">
77-
<TextBlock>You can adjust the corner radius</TextBlock>
78+
Padding="8" UniformCornerRadius="6">
79+
<TextBlock TextWrapping="Wrap">You can adjust the corner radius</TextBlock>
7880
</wpf:Card>
7981
</WrapPanel>
8082
</UserControl>

MainDemo.Wpf/Grids.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
ItemsSourceBinding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.Foods}" />
6868
</DataGrid.Columns>
6969
</DataGrid>
70-
<TextBlock Margin="0 24 0 0" >Auto Generated Columns</TextBlock>
70+
<TextBlock Margin="0 24 0 0">Auto Generated Columns</TextBlock>
7171
<DataGrid Margin="0 8 0 0" ItemsSource="{Binding Items3}" CanUserSortColumns="True" CanUserAddRows="False" />
7272
</StackPanel>
7373
</ScrollViewer>

MainDemo.Wpf/Home.xaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
VerticalAlignment="Bottom"
2828
Margin="0 0 0 32">
2929
<StackPanel Orientation="Horizontal">
30-
<wpf:Card Width="420" VerticalAlignment="Top" Margin="4 2 8 16" Height="280">
30+
<wpf:Card Width="420" Margin="4 2 8 16" Height="280">
3131
<Grid VerticalAlignment="Stretch" >
3232
<Grid.RowDefinitions>
3333
<RowDefinition Height="Auto" />
@@ -45,7 +45,8 @@
4545
VerticalAlignment="Top">Say hello, make a feature request, or raise a bug through one of these channels:</TextBlock>
4646
<Border Grid.Column="1" Grid.Row="2" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Margin="0 8 0 0">
4747
<Grid Margin="8">
48-
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left">
48+
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left"
49+
x:Name="GitHubButton" Click="GitHubButton_OnClick">
4950
<StackPanel Orientation="Horizontal">
5051
<Viewbox Width="16" Height="16">
5152
<Canvas Width="24" Height="24">
@@ -56,7 +57,8 @@
5657
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">GitHub</TextBlock>
5758
</StackPanel>
5859
</Button>
59-
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right">
60+
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right"
61+
x:Name="TwitterButton" Click="TwitterButton_OnClick">
6062
<StackPanel Orientation="Horizontal">
6163
<Viewbox Width="16" Height="16">
6264
<Canvas Width="24" Height="24">
@@ -71,7 +73,8 @@
7173
</Border>
7274
<Border Grid.Column="1" Grid.Row="3" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}">
7375
<Grid Margin="8">
74-
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left">
76+
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Left"
77+
x:Name="ChatButton" Click="ChatButton_OnClick">
7578
<StackPanel Orientation="Horizontal">
7679
<Viewbox Width="16" Height="16">
7780
<Canvas Width="24" Height="24">
@@ -82,7 +85,8 @@
8285
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Chat</TextBlock>
8386
</StackPanel>
8487
</Button>
85-
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right">
88+
<Button Style="{DynamicResource MaterialDesignFlatButton}" HorizontalAlignment="Right"
89+
x:Name="EmailButton" Click="EmailButton_OnClick">
8690
<StackPanel Orientation="Horizontal">
8791
<Viewbox Width="16" Height="16">
8892
<Canvas Width="24" Height="24">
@@ -97,7 +101,7 @@
97101
</Border>
98102
</Grid>
99103
</wpf:Card>
100-
<wpf:Card Width="420" VerticalAlignment="Top" Margin="8 2 4 16" Height="280">
104+
<wpf:Card Width="420" Margin="8 2 4 16" Height="280">
101105
<Grid VerticalAlignment="Stretch">
102106
<Grid.RowDefinitions>
103107
<RowDefinition Height="Auto" />
@@ -114,7 +118,7 @@
114118
<StackPanel Grid.Column="1">
115119
<TextBlock FontSize="28" Margin="16 16 16 8" FontWeight="Light">Open Source</TextBlock>
116120
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8" Foreground="{DynamicResource MaterialDesignBodyLight}"
117-
VerticalAlignment="Top">This project is completely open source. If you like and want to say thanks you could hit the GitHub Star button, tweet or post about it, or tell your mum about it!</TextBlock>
121+
VerticalAlignment="Top">This project is completely open source. If you like it and want to say thanks you could hit the GitHub Star button, tweet or post about it, or tell your mum about it!</TextBlock>
118122
</StackPanel>
119123
</Grid>
120124
</wpf:Card>

MainDemo.Wpf/Home.xaml.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Linq;
45
using System.Text;
56
using System.Threading.Tasks;
@@ -24,5 +25,25 @@ public Home()
2425
{
2526
InitializeComponent();
2627
}
28+
29+
private void GitHubButton_OnClick(object sender, RoutedEventArgs e)
30+
{
31+
Process.Start("https://github.com/ButchersBoy/MaterialDesignInXamlToolkit");
32+
}
33+
34+
private void TwitterButton_OnClick(object sender, RoutedEventArgs e)
35+
{
36+
Process.Start("https://twitter.com/James_Willock");
37+
}
38+
39+
private void ChatButton_OnClick(object sender, RoutedEventArgs e)
40+
{
41+
Process.Start("https://gitter.im/ButchersBoy/MaterialDesignInXamlToolkit");
42+
}
43+
44+
private void EmailButton_OnClick(object sender, RoutedEventArgs e)
45+
{
46+
Process.Start("mailto://[email protected]");
47+
}
2748
}
2849
}

MainDemo.Wpf/MainDemo.Wpf.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4444
<Prefer32Bit>true</Prefer32Bit>
4545
</PropertyGroup>
46+
<PropertyGroup>
47+
<ApplicationIcon>favicon.ico</ApplicationIcon>
48+
</PropertyGroup>
4649
<ItemGroup>
4750
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
4851
<Reference Include="PresentationFramework.Aero2" />
@@ -222,6 +225,9 @@
222225
<ItemGroup>
223226
<Resource Include="Resources\Contact.png" />
224227
</ItemGroup>
228+
<ItemGroup>
229+
<Resource Include="favicon.ico" />
230+
</ItemGroup>
225231
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
226232
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
227233
Other similar extension points exist, see Microsoft.Common.targets.

MainDemo.Wpf/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TextOptions.TextFormattingMode="Ideal"
1212
TextOptions.TextRenderingMode="Auto"
1313
Background="{DynamicResource MaterialDesignPaper}"
14-
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto">
14+
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" Icon="favicon.ico">
1515
<Window.Resources>
1616
<ResourceDictionary>
1717
<ResourceDictionary.MergedDictionaries>

0 commit comments

Comments
 (0)