Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/MainDemo.Wpf/Alerts.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl x:Class="MaterialDesignDemo.Alerts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sharedAlerts="clr-namespace:MaterialDesignDemo.Shared.Examples.Alerts;assembly=MaterialDesignDemo.Shared">
<StackPanel>
<TextBlock Margin="0,0,0,16"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Alert" />
<sharedAlerts:AlertExamples />
<sharedAlerts:AlertWithTitleExamples Margin="0,16,0,0" />
<sharedAlerts:AlertCornerRadiusExamples Margin="0,16,0,0" />
<sharedAlerts:AlertElevationExamples Margin="0,16,0,0" />
<sharedAlerts:AlertCloseExamples Margin="0,16,0,0" />
</StackPanel>
</UserControl>
6 changes: 6 additions & 0 deletions src/MainDemo.Wpf/Alerts.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesignDemo;

public partial class Alerts
{
public Alerts() => InitializeComponent();
}
9 changes: 9 additions & 0 deletions src/MainDemo.Wpf/Domain/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ private static IEnumerable<DemoItem> GenerateDemoItems(ISnackbarMessageQueue sna
HorizontalScrollBarVisibilityRequirement = ScrollBarVisibility.Disabled
};

yield return new DemoItem(
"Alert",
typeof(Alerts),
[
DocumentationLink.DemoPageLink<Alerts>(),
DocumentationLink.StyleLink("Alert"),
DocumentationLink.ApiLink<Alert>()
]);

yield return new DemoItem(
"Icons",
typeof(IconPack),
Expand Down
15 changes: 15 additions & 0 deletions src/MaterialDesign3.Demo.Wpf/Alerts.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl x:Class="MaterialDesign3Demo.Alerts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sharedAlerts="clr-namespace:MaterialDesignDemo.Shared.Examples.Alerts;assembly=MaterialDesignDemo.Shared">
<StackPanel>
<TextBlock Margin="0,0,0,16"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Alert" />
<sharedAlerts:AlertExamples />
<sharedAlerts:AlertWithTitleExamples Margin="0,16,0,0" />
<sharedAlerts:AlertCornerRadiusExamples Margin="0,16,0,0" />
<sharedAlerts:AlertElevationExamples Margin="0,16,0,0" />
<sharedAlerts:AlertCloseExamples Margin="0,16,0,0" />
</StackPanel>
</UserControl>
6 changes: 6 additions & 0 deletions src/MaterialDesign3.Demo.Wpf/Alerts.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesign3Demo;

public partial class Alerts
{
public Alerts() => InitializeComponent();
}
11 changes: 11 additions & 0 deletions src/MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ private static IEnumerable<DemoItem> GenerateDemoItems(ISnackbarMessageQueue sna
selectedIcon: PackIconKind.Card,
unselectedIcon: PackIconKind.CardOutline);

yield return new DemoItem(
"Alert",
typeof(Alerts),
[
DocumentationLink.DemoPageLink<Alerts>(),
DocumentationLink.StyleLink("Alert"),
DocumentationLink.ApiLink<Alert>()
],
selectedIcon: PackIconKind.AlertCircle,
unselectedIcon: PackIconKind.AlertCircleOutline);

yield return new DemoItem(
"Icon Pack",
typeof(IconPack),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.Alerts.AlertCloseExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML">
<materialDesign:Card Padding="16">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Closable alerts" />
<WrapPanel>
<WrapPanel.Resources>
<Style TargetType="smtx:XamlDisplay" BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
<Setter Property="Margin" Value="0,0,16,8" />
</Style>
</WrapPanel.Resources>
<smtx:XamlDisplay UniqueKey="AlertExamples_CloseInfo">
<materialDesign:Alert x:Name="InfoAlert"
CloseClick="Alert_OnCloseClick"
Content="Click the close icon to dismiss me"
Severity="Info"
ShowCloseButton="True" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CloseWarning">
<materialDesign:Alert x:Name="WarningAlert"
Title="Warning"
CloseClick="Alert_OnCloseClick"
Content="This alert can be dismissed as well."
Severity="Warning"
ShowCloseButton="True" />
</smtx:XamlDisplay>
</WrapPanel>
<Button HorizontalAlignment="Left"
Click="Reset_OnClick"
Content="Reset" />
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace MaterialDesignDemo.Shared.Examples.Alerts;

public partial class AlertCloseExamples : UserControl
{
public AlertCloseExamples() => InitializeComponent();

private void Alert_OnCloseClick(object sender, RoutedEventArgs e)
=> ((UIElement)sender).Visibility = Visibility.Hidden;

private void Reset_OnClick(object sender, RoutedEventArgs e)
{
InfoAlert.Visibility = Visibility.Visible;
WarningAlert.Visibility = Visibility.Visible;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.Alerts.AlertCornerRadiusExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML">
<materialDesign:Card Padding="16">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Corner radius" />
<WrapPanel>
<WrapPanel.Resources>
<Style TargetType="smtx:XamlDisplay" BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
<Setter Property="Margin" Value="0,0,16,8" />
</Style>
</WrapPanel.Resources>
<smtx:XamlDisplay UniqueKey="AlertExamples_CornerRadiusNone">
<materialDesign:Alert Content="No corner radius"
CornerRadius="0"
Severity="Info" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CornerRadiusLarge">
<materialDesign:Alert Content="Large corner radius"
CornerRadius="16"
Severity="Success" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CornerRadiusLarger">
<materialDesign:Alert Content="Larger corner radius"
CornerRadius="32"
Severity="Success" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CornerRadiusMixed">
<materialDesign:Alert Title="Warning"
Content="Mixed corner radius"
CornerRadius="16,0,16,0"
Severity="Warning" />
</smtx:XamlDisplay>
</WrapPanel>
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesignDemo.Shared.Examples.Alerts;

public partial class AlertCornerRadiusExamples : UserControl
{
public AlertCornerRadiusExamples() => InitializeComponent();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.Alerts.AlertElevationExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML">
<materialDesign:Card Padding="16">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Elevation" />
<WrapPanel>
<WrapPanel.Resources>
<Style TargetType="smtx:XamlDisplay" BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
<Setter Property="Margin" Value="0,0,16,8" />
</Style>
</WrapPanel.Resources>
<smtx:XamlDisplay UniqueKey="AlertExamples_ElevationDp0">
<materialDesign:Alert materialDesign:ElevationAssist.Elevation="Dp0"
Content="Elevation Dp0"
Severity="Error" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_ElevationDp1">
<materialDesign:Alert materialDesign:ElevationAssist.Elevation="Dp1"
Content="Elevation Dp1"
Severity="Info" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_ElevationDp4">
<materialDesign:Alert materialDesign:ElevationAssist.Elevation="Dp4"
Content="Elevation Dp4"
Severity="Success" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_ElevationDp8">
<materialDesign:Alert Title="Warning"
materialDesign:ElevationAssist.Elevation="Dp8"
Content="Elevation Dp8"
Severity="Warning" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_ElevationNone">
<materialDesign:Alert materialDesign:ElevationAssist.Elevation="Dp4" Content="Elevation Dp4 without severity" />
</smtx:XamlDisplay>
</WrapPanel>
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesignDemo.Shared.Examples.Alerts;

public partial class AlertElevationExamples : UserControl
{
public AlertElevationExamples() => InitializeComponent();
}
62 changes: 62 additions & 0 deletions src/MaterialDesignDemo.Shared/Examples/Alerts/AlertExamples.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.Alerts.AlertExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML">
<materialDesign:Card Padding="16">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Basic usage" />
<StackPanel>
<StackPanel.Resources>
<Style TargetType="smtx:XamlDisplay" BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
<Setter Property="Margin" Value="0,0,16,8" />
</Style>
</StackPanel.Resources>
<WrapPanel>
<smtx:XamlDisplay UniqueKey="AlertExamples_None">
<materialDesign:Alert Content="The reactor type is RBMK-1000" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_Info">
<materialDesign:Alert Content="The reactor was fired up successfully" Severity="Info" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_Success">
<materialDesign:Alert Content="The reactor is running at optimum temperature" Severity="Success" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_Warning">
<materialDesign:Alert Content="The reactor temperature exceeds the optimal range" Severity="Warning" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_Error">
<materialDesign:Alert Content="Meltdown is imminent" Severity="Error" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CustomIcon">
<materialDesign:Alert Content="Custom icon"
IconKind="Radioactive"
Severity="Warning" />
</smtx:XamlDisplay>
</WrapPanel>

<WrapPanel>
<smtx:XamlDisplay UniqueKey="AlertExamples_Multiline">
<materialDesign:Alert MaxWidth="300"
Content="The reactor core temperature has been rising steadily for the past hour. Please check the coolant pumps and control rods before continuing operation."
Severity="Info" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_CustomContent" VerticalAlignment="Center">
<materialDesign:Alert Severity="Error">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="Control rods are stuck" />
<Button Margin="16,0,0,0"
Content="SCRAM"
Style="{StaticResource MaterialDesignFlatButton}" />
</StackPanel>
</materialDesign:Alert>
</smtx:XamlDisplay>
</WrapPanel>

</StackPanel>

</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesignDemo.Shared.Examples.Alerts;

public partial class AlertExamples : UserControl
{
public AlertExamples() => InitializeComponent();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.Alerts.AlertWithTitleExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML">
<materialDesign:Card Padding="16">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Title" />
<WrapPanel>
<WrapPanel.Resources>
<Style TargetType="smtx:XamlDisplay" BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}">
<Setter Property="Margin" Value="0,0,16,8" />
</Style>
</WrapPanel.Resources>
<smtx:XamlDisplay UniqueKey="AlertExamples_TitleNone">
<materialDesign:Alert Title="Note" Content="This is an Alert with a neutral title." />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_TitleInfo">
<materialDesign:Alert Title="Info"
Content="This is an info Alert with an informative title."
Severity="Info" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_TitleSuccess">
<materialDesign:Alert Title="Success"
Content="This is a success Alert with an encouraging title."
Severity="Success" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_TitleWarning">
<materialDesign:Alert Title="Warning"
Content="This is a warning Alert with a cautious title."
Severity="Warning" />
</smtx:XamlDisplay>
<smtx:XamlDisplay UniqueKey="AlertExamples_TitleError">
<materialDesign:Alert Title="Error"
Content="This is an error Alert with a scary title."
Severity="Error" />
</smtx:XamlDisplay>
</WrapPanel>
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MaterialDesignDemo.Shared.Examples.Alerts;

public partial class AlertWithTitleExamples : UserControl
{
public AlertWithTitleExamples() => InitializeComponent();
}
Loading
Loading