Skip to content

Commit f5ad5c1

Browse files
committed
linear progress bars
1 parent 39396c5 commit f5ad5c1

File tree

11 files changed

+191
-14
lines changed

11 files changed

+191
-14
lines changed

MahMaterialDragablzMashUp/Dialogs.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
d:DataContext="{d:DesignInstance local:DialogsViewModel}">
1212
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
1313
<Button Command="{Binding ShowInputDialogCommand}">INPUT DIALOG</Button>
14+
<Button Command="{Binding ShowProgressDialogCommand}" Margin="0 48 0 0">PROGRESS DIALOG</Button>
1415
</StackPanel>
1516
</UserControl>

MahMaterialDragablzMashUp/DialogsViewModel.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ namespace MahMaterialDragablzMashUp
1212
{
1313
public class DialogsViewModel
1414
{
15-
public ICommand ShowInputDialogCommand { get; }
15+
public ICommand ShowInputDialogCommand { get; }
16+
17+
public ICommand ShowProgressDialogCommand { get; }
1618

1719
public DialogsViewModel()
1820
{
19-
ShowInputDialogCommand = new AnotherCommandImplementation(_ => InputDialog());
21+
ShowInputDialogCommand = new AnotherCommandImplementation(_ => InputDialog());
22+
ShowProgressDialogCommand = new AnotherCommandImplementation(_ => ProgressDialog());
2023
}
2124

2225
private void InputDialog()
@@ -34,5 +37,21 @@ private void InputDialog()
3437

3538
DialogCoordinator.Instance.ShowInputAsync(this, "MahApps Dialog", "Using Material Design Themes", metroDialogSettings);
3639
}
40+
41+
private void ProgressDialog()
42+
{
43+
var metroDialogSettings = new MetroDialogSettings
44+
{
45+
CustomResourceDictionary =
46+
new ResourceDictionary
47+
{
48+
Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.MahApps.Dialogs.xaml")
49+
},
50+
NegativeButtonText = "CANCEL",
51+
SuppressDefaultResources = true
52+
};
53+
54+
DialogCoordinator.Instance.ShowProgressAsync(this, "MahApps Dialog", "Using Material Design Themes (WORK IN PROGRESS)", true, metroDialogSettings);
55+
}
3756
}
3857
}

MaterialDesignColors.WpfExample/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" Checked="ToggleButton_OnChecked" Unchecked="ToggleButton_OnChecked" IsChecked="{Binding ElementName=FieldsRadioButton, Path=IsChecked, Mode=OneWay}" />
8282
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" x:Name="ButtonsRadioButton" IsChecked="True" Margin="8 0 0 0" VerticalAlignment="Center">Buttons</RadioButton>
8383
<RadioButton Style="{StaticResource MaterialDesignRadioButton}" x:Name="FieldsRadioButton" Margin="8 0 0 0" VerticalAlignment="Center">Fields</RadioButton>
84+
<Button Click="ProgressButton_OnClick" Margin="48 0 0 0">PROGRESS</Button>
8485
</StackPanel>
8586
<wpfExample:Buttons Visibility="{Binding ElementName=ButtonsRadioButton, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}" />
8687
<wpfExample:TextFields Visibility="{Binding ElementName=FieldsRadioButton, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}" />

MaterialDesignColors.WpfExample/MainWindow.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@ private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
3939
FieldsRadioButton.IsChecked = ((ToggleButton) sender).IsChecked;
4040
ButtonsRadioButton.IsChecked = !((ToggleButton)sender).IsChecked;
4141
}
42+
43+
private void ProgressButton_OnClick(object sender, RoutedEventArgs e)
44+
{
45+
new ProgressWindow().Show();
46+
}
4247
}
4348
}

MaterialDesignColors.WpfExample/MaterialDesignColors.WpfExample.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
<Compile Include="PaletteSelectorWindow.xaml.cs">
8585
<DependentUpon>PaletteSelectorWindow.xaml</DependentUpon>
8686
</Compile>
87+
<Compile Include="ProgressWindow.xaml.cs">
88+
<DependentUpon>ProgressWindow.xaml</DependentUpon>
89+
</Compile>
8790
<Compile Include="ProvingGround.xaml.cs">
8891
<DependentUpon>ProvingGround.xaml</DependentUpon>
8992
</Compile>
@@ -122,6 +125,10 @@
122125
<SubType>Designer</SubType>
123126
<Generator>MSBuild:Compile</Generator>
124127
</Page>
128+
<Page Include="ProgressWindow.xaml">
129+
<SubType>Designer</SubType>
130+
<Generator>MSBuild:Compile</Generator>
131+
</Page>
125132
<Page Include="ProvingGround.xaml">
126133
<SubType>Designer</SubType>
127134
<Generator>MSBuild:Compile</Generator>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Window x:Class="MaterialDesignColors.WpfExample.ProgressWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
mc:Ignorable="d"
7+
Title="Progress Indicators" Height="300" Width="600">
8+
<Grid>
9+
<Grid.ColumnDefinitions>
10+
<ColumnDefinition Width="Auto" />
11+
<ColumnDefinition Width="Auto" />
12+
<ColumnDefinition Width="*" />
13+
</Grid.ColumnDefinitions>
14+
<ProgressBar Orientation="Vertical" Value="25" Margin="24" />
15+
<ProgressBar Orientation="Vertical" IsIndeterminate="True" Grid.Column="1" Margin="24" />
16+
<StackPanel Grid.Column="2" HorizontalAlignment="Stretch">
17+
<ProgressBar Value="25" Margin="24" />
18+
<ProgressBar Value="50" Margin="24" />
19+
<ProgressBar Value="75" Margin="24" />
20+
<ProgressBar IsIndeterminate="True" Margin="24" />
21+
</StackPanel>
22+
</Grid>
23+
</Window>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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.Shapes;
14+
15+
namespace MaterialDesignColors.WpfExample
16+
{
17+
/// <summary>
18+
/// Interaction logic for ProgressWindow.xaml
19+
/// </summary>
20+
public partial class ProgressWindow : Window
21+
{
22+
public ProgressWindow()
23+
{
24+
InitializeComponent();
25+
}
26+
}
27+
}

MaterialDesignColors.WpfExample/ProvingGround.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@
4949
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="{StaticResource Accent700Foreground}"/>
5050
</ResourceDictionary>
5151
</ResourceDictionary.MergedDictionaries>
52+
5253

5354

5455

5556

5657

58+
5759
</ResourceDictionary>
5860

5961
</UserControl.Resources>
6062

6163
<Grid>
62-
<Button>
63-
<Button.ToolTip>
64-
<ToolTip>
65-
<TextBlock>And here is your tooltip.</TextBlock>
66-
</ToolTip>
67-
</Button.ToolTip>
68-
Hello World
69-
</Button>
64+
<StackPanel Margin="1.5,0,-1.5,0">
65+
<ProgressBar Value="25" Maximum="100" HorizontalAlignment="Stretch" Margin="24" />
66+
<ProgressBar Value="50" Maximum="100" HorizontalAlignment="Stretch" Margin="24" />
67+
<ProgressBar Value="75" Maximum="100" HorizontalAlignment="Stretch" Margin="24" />
68+
<ProgressBar IsIndeterminate="True" HorizontalAlignment="Stretch" Margin="24" />
69+
</StackPanel>
7070
</Grid>
7171

7272
</UserControl>

MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
<SubType>Designer</SubType>
105105
<Generator>MSBuild:Compile</Generator>
106106
</Page>
107+
<Page Include="Themes\MaterialDesignTheme.ProgressBar.xaml">
108+
<SubType>Designer</SubType>
109+
<Generator>MSBuild:Compile</Generator>
110+
</Page>
107111
<Page Include="Themes\MaterialDesignTheme.ScrollBar.xaml">
108112
<SubType>Designer</SubType>
109113
<Generator>MSBuild:Compile</Generator>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.listbox.xaml" />
1515
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Menu.xaml" />
1616
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PasswordBox.xaml" />
17+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ProgressBar.xaml" />
1718
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RadioButton.xaml" />
1819
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ScrollBar.xaml" />
1920
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ScrollViewer.xaml" />
@@ -26,17 +27,16 @@
2627
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignRaisedButton}" />
2728
<Style TargetType="{x:Type Calendar}" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" />
2829
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}" />
29-
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}" />
30-
30+
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}" />
3131
<Style TargetType="{x:Type DataGrid}" BasedOn="{StaticResource MaterialDesignDataGrid}" />
3232
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}" />
3333
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" />
3434
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MaterialDesignDataGridRow}" />
3535
<Style TargetType="{x:Type DataGridRowHeader}" BasedOn="{StaticResource MaterialDesignDataGridRowHeader}" />
36-
3736
<Style TargetType="{x:Type DatePicker}" BasedOn="{StaticResource MaterialDesignDatePicker}" />
3837
<Style TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}" />
39-
<Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource MaterialDesignPasswordBox}" />
38+
<Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource MaterialDesignPasswordBox}" />
39+
<Style TargetType="{x:Type ProgressBar}" BasedOn="{StaticResource MaterialDesignLinearProgressBar}" />
4040
<Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}" />
4141
<Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource MaterialDesignScrollBar}" />
4242
<Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MaterialDesignScrollViewer}" />

0 commit comments

Comments
 (0)