Skip to content

Commit 1d7cc9f

Browse files
committed
Successfully injected XamlDisplayerPanel into Progress.xaml
1 parent e9802e7 commit 1d7cc9f

File tree

2 files changed

+19
-66
lines changed

2 files changed

+19
-66
lines changed

MainDemo.Wpf/Progress.xaml

Lines changed: 17 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
7+
xmlns:codeDisplayer="clr-namespace:CodeDisplayer;assembly=CodeDisplayer"
78
mc:Ignorable="d"
89
d:DesignHeight="300" d:DesignWidth="300">
910

@@ -15,86 +16,42 @@
1516
</ResourceDictionary.MergedDictionaries>
1617
</ResourceDictionary>
1718
</UserControl.Resources>
18-
19-
<Grid>
20-
<Grid.ColumnDefinitions>
21-
<ColumnDefinition Width="Auto" />
22-
<ColumnDefinition Width="Auto" />
23-
<ColumnDefinition Width="*" />
24-
</Grid.ColumnDefinitions>
25-
<Grid.RowDefinitions>
26-
<RowDefinition Height="Auto" />
27-
<RowDefinition Height="*" />
28-
</Grid.RowDefinitions>
29-
<!-- linear progress bars (the default style -->
30-
<ProgressBar Orientation="Vertical" Value="25" Margin="24" Grid.RowSpan="2" />
31-
<ProgressBar Orientation="Vertical" Height="10" IsIndeterminate="True" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Margin="24" />
32-
<StackPanel Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch">
33-
<ProgressBar Value="25" Margin="24" Height="10" />
34-
<ProgressBar Value="50" Margin="24" materialDesign:TransitionAssist.DisableTransitions="True" /> <!-- should disable on 2nd transition... -->
35-
<ProgressBar Value="75" Margin="24" />
36-
<ProgressBar IsIndeterminate="True" Margin="24" />
37-
</StackPanel>
38-
39-
<!-- circular progress bars.. specify the MaterialDesignCicularProgressBar resource -->
40-
<Grid VerticalAlignment="Top" Grid.Column="2" Grid.Row="1">
41-
<Grid.RowDefinitions>
42-
<RowDefinition Height="Auto" />
43-
<RowDefinition Height="Auto" />
44-
<RowDefinition Height="Auto" />
45-
<RowDefinition Height="Auto" />
46-
<RowDefinition Height="Auto" />
47-
<RowDefinition Height="Auto" />
48-
<RowDefinition Height="Auto" />
49-
</Grid.RowDefinitions>
50-
<Grid.ColumnDefinitions>
51-
<ColumnDefinition Width="Auto" />
52-
<ColumnDefinition Width="*" />
53-
</Grid.ColumnDefinitions>
54-
55-
<TextBlock Grid.ColumnSpan="2" FontSize="16" TextWrapping="Wrap" TextAlignment="Center" HorizontalAlignment="Stretch"
56-
Margin="0 0 0 16">
57-
No extra control is required for the circular style, it is purely a standard ProgressBar, with the MaterialDesignCircularProgressBar style applied.
58-
</TextBlock>
59-
19+
<ScrollViewer>
20+
<codeDisplayer:XamlDisplayerPanel x:Name="XamlDisplayerPanel">
21+
<ProgressBar Orientation="Vertical" Width="200" Height="10" Value="25" />
22+
<ProgressBar Orientation="Vertical" Width="200" Height="10" IsIndeterminate="True" />
23+
<ProgressBar Value="25" Width="200" Height="10" />
24+
<ProgressBar Value="50" Width="200" Height="10" materialDesign:TransitionAssist.DisableTransitions="True" />
25+
<ProgressBar Value="75" Width="200" Height="10"/>
26+
<ProgressBar IsIndeterminate="True" Width="200" Height="10"/>
6027
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
6128
x:Name="DeterminateCircularProgress"
62-
Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12" />
63-
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" TextWrapping="Wrap">Standard deterministic progress bar, running from 0 to 100%. &#160;For the purpose of the demo, a storyboard is used to animate the .Value property.</TextBlock>
64-
29+
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12" />
6530
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
6631
Value="35"
6732
IsIndeterminate="True"
68-
Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12"/>
69-
<TextBlock Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" TextWrapping="Wrap">Indeterminate progress bar, at 35%.</TextBlock>
70-
33+
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12"/>
7134
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
7235
Value="0"
7336
IsIndeterminate="True"
74-
Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12"/>
75-
<TextBlock Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" TextWrapping="Wrap">Fully indeterminate progress bar, using .Value=0 to inform the theme.</TextBlock>
76-
37+
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12"/>
7738
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
7839
Value="20"
7940
IsIndeterminate="True"
8041
x:Name="IndeterminateToDeterminateCircularProgress"
81-
Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12" />
82-
<TextBlock Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" TextWrapping="Wrap">An indeterminate job transitioning to a determinate job, completing to 100%. &#160;For the purpose of the demo, a storyboard is used to animate the .Value and .IsIndeterminate properties.</TextBlock>
83-
42+
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12" />
8443
<materialDesign:Card UniformCornerRadius="14" Padding="4"
85-
Grid.Row="5" Grid.Column="0"
44+
8645
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12">
8746
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
8847
Value="50"
8948
IsIndeterminate="True"
9049
/>
9150
</materialDesign:Card>
92-
<TextBlock Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" TextWrapping="Wrap">Wrap in a Card control to raise the material.</TextBlock>
93-
9451
<materialDesign:Card UniformCornerRadius="14"
9552
RenderTransformOrigin=".5,.5"
9653
Padding="4"
97-
Grid.Row="6" Grid.Column="0"
54+
9855
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="12 12 12 12">
9956
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}"
10057
x:Name="AnimatedProgressInCard"
@@ -162,14 +119,8 @@
162119
</materialDesign:Card.Style>
163120

164121
</materialDesign:Card>
165-
<TextBlock Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" TextWrapping="Wrap">Apply some animations to the card to get funky!</TextBlock>
166-
167-
</Grid>
168-
</Grid>
169-
170-
<!-- these animations are used to control the circular progress bars' values, so we don't need
171-
code-behind or a view model to illustrate them in action
172-
-->
122+
</codeDisplayer:XamlDisplayerPanel>
123+
</ScrollViewer>
173124
<UserControl.Triggers>
174125
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
175126
<EventTrigger.Actions>

MainDemo.Wpf/Progress.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
15+
using MaterialDesignDemo.Helper;
1516

1617
namespace MaterialDesignColors.WpfExample
1718
{
@@ -23,6 +24,7 @@ public partial class Progress : UserControl
2324
public Progress()
2425
{
2526
InitializeComponent();
27+
XamlDisplayerPanel.Initialize(new SourceRouter(this.GetType().Name).GetSource());
2628
}
2729
}
2830
}

0 commit comments

Comments
 (0)