Skip to content

Commit

Permalink
1.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Jun 17, 2023
1 parent 120f12c commit 2a6d561
Show file tree
Hide file tree
Showing 19 changed files with 560 additions and 81 deletions.
19 changes: 16 additions & 3 deletions Samples/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<pu:MessageBoxXSettings x:Key="messageSetting">
<pu:MessageBoxXSettings.WindowXStyle>
<Style TargetType="pu:WindowX"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=WindowXStyleKey, TypeInTargetAssembly={x:Type pu:MessageBoxX}}}">
BasedOn="{StaticResource {x:Static pu:MessageBoxX.WindowXStyleKey}}">
<Setter Property="SizeToContent"
Value="Manual" />
<Setter Property="Width"
Expand All @@ -27,7 +27,7 @@
</pu:MessageBoxXSettings.WindowXStyle>
<pu:MessageBoxXSettings.ButtonStyle>
<Style TargetType="Button"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=ButtonStyleKey, TypeInTargetAssembly={x:Type pu:MessageBoxX}}}">
BasedOn="{StaticResource {x:Static pu:MessageBoxX.ButtonStyleKey}}">
<Setter Property="pu:ButtonHelper.CornerRadius"
Value="4" />
<Style.Triggers>
Expand All @@ -46,7 +46,7 @@
<pu:NoticeBoxSettings x:Key="noticeSetting">
<pu:NoticeBoxSettings.NoticeBoxItemStyle>
<Style TargetType="pu:NoticeBoxItem"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=NoticeBoxItemStyleKey, TypeInTargetAssembly={x:Type pu:NoticeBox}}}">
BasedOn="{StaticResource {x:Static pu:NoticeBox.NoticeBoxItemStyleKey}}">
<Setter Property="Background"
Value="{DynamicResource WindowBackground}" />
<Setter Property="BorderBrush"
Expand Down Expand Up @@ -103,6 +103,19 @@
</pu:PendingBoxSettings.CancelButtonStyle>
</pu:PendingBoxSettings>

<pu:ToastSettings x:Key="toastSetting"
Spacing="25">
<pu:ToastSettings.LabelStyle>
<Style TargetType="Label"
BasedOn="{StaticResource {x:Static pu:Toast.LabelStyleKey}}">
<Setter Property="Background"
Value="{DynamicResource ToastBackground}" />
<Setter Property="Foreground"
Value="{DynamicResource ToastForeground}" />
</Style>
</pu:ToastSettings.LabelStyle>
</pu:ToastSettings>

<pu:GlobalSettings x:Key="settings">
<pu:GlobalSettings.Themes>
<pu:ApplicationTheme Key="Light"
Expand Down
4 changes: 3 additions & 1 deletion Samples/Themes/Dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<SolidColorBrush x:Key="WindowBackground">#1E1E1E</SolidColorBrush>
<SolidColorBrush x:Key="BodyForeground">#FFFFFF</SolidColorBrush>
<SolidColorBrush x:Key="DescriptionForeground">#8E8E8E</SolidColorBrush>


<SolidColorBrush x:Key="ToastBackground">#6E6E6E</SolidColorBrush>
<SolidColorBrush x:Key="ToastForeground">#FFFFFF</SolidColorBrush>
</ResourceDictionary>
5 changes: 4 additions & 1 deletion Samples/Themes/Light.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
<SolidColorBrush x:Key="WindowBackground">#FFFFFF</SolidColorBrush>
<SolidColorBrush x:Key="BodyForeground">#1E1E1E</SolidColorBrush>
<SolidColorBrush x:Key="DescriptionForeground">#8E8E8E</SolidColorBrush>


<SolidColorBrush x:Key="ToastBackground">#1E1E1E</SolidColorBrush>
<SolidColorBrush x:Key="ToastForeground">#FFFFFF</SolidColorBrush>

</ResourceDictionary>
5 changes: 4 additions & 1 deletion Samples/Views/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
Height="30">
<Button Content="MessageBoxX"
<Button Content="Toast"
Click="BtnToast_Click" />
<Button Margin="10,0,0,0"
Content="MessageBoxX"
Click="BtnTestMessageBoxX_Click" />
<Button Margin="10,0,0,0"
Content="NoticeBox"
Expand Down
7 changes: 6 additions & 1 deletion Samples/Views/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ private async void BtnTestPendingBox_Click(object sender, RoutedEventArgs e)
//handler.Cancelling += ...
//handler.Close();
}
private void BtnToast_Click(object sender, RoutedEventArgs e)
{
Toast("Toast style configuration is placed in App.xaml.", 2000);
//Panuon.WPF.UI.Toast.Show(this, "Toast style configuration is placed in App.xaml.", 2000);
}
#endregion

#region Functions
Expand Down Expand Up @@ -150,8 +155,8 @@ private UIElement CreatePreviewView(WindowX view, object content)
};
return border;
}

#endregion


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Styles\ToastStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Styles\NumberInputStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Panuon.WPF.UI"
xmlns:core="clr-namespace:Panuon.WPF;assembly=Panuon.WPF"
xmlns:i="clr-namespace:Panuon.WPF.UI.Internal"
xmlns:rs="clr-namespace:Panuon.WPF.UI.Resources"
xmlns:irs="clr-namespace:Panuon.WPF.UI.Internal.Resources">
<ResourceDictionary.MergedDictionaries>
<core:SharedResourceDictionary Source="pack://application:,,,/Panuon.WPF.UI;component/Styles/LabelStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="{ComponentResourceKey ResourceId=LabelStyleKey, TypeInTargetAssembly={x:Type local:Toast}}"
TargetType="Label"
BasedOn="{StaticResource {x:Static rs:StyleKeys.LabelStyle}}">
<Setter Property="local:IconHelper.FontFamily"
Value="{Binding IconFontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:IconHelper.FontSize"
Value="{Binding IconFontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="local:ShadowHelper.BlurRadius"
Value="25" />
<Setter Property="FontFamily"
Value="{Binding FontFamily, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="FontSize"
Value="{Binding FontSize, Source={x:Static local:GlobalSettings.Setting}}" />
<Setter Property="MaxWidth"
Value="350" />
<Setter Property="VerticalContentAlignment"
Value="Stretch" />
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="Padding"
Value="15,7" />
<Setter Property="Background"
Value="Black" />
<Setter Property="Foreground"
Value="White" />
<Setter Property="local:LabelHelper.CornerRadius"
Value="2" />
<Setter Property="local:LabelHelper.ShadowColor"
Value="Gray" />
</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
Visibility="Collapsed" />
<ContentControl Content="{TemplateBinding Overlayer}"
Visibility="{Binding IsOverlayerVisible, Converter={StaticResource {x:Static rs:ConverterKeys.FalseToCollapseConverter}}, RelativeSource={RelativeSource AncestorType=local:WindowX}, Mode=OneWay}" />
<Canvas x:Name="PART_ToastCanvas"
IsHitTestVisible="False" />
</Grid>
</Border>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -481,6 +483,8 @@
Visibility="Collapsed" />
<ContentControl Content="{TemplateBinding Overlayer}"
Visibility="{Binding IsOverlayerVisible, Converter={StaticResource {x:Static rs:ConverterKeys.FalseToCollapseConverter}}, RelativeSource={RelativeSource AncestorType=local:WindowX}, Mode=OneWay}" />
<Canvas x:Name="PART_ToastCanvas"
IsHitTestVisible="False" />
</Grid>
</Border>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -779,6 +783,8 @@
Visibility="Collapsed" />
<ContentControl Content="{TemplateBinding Overlayer}"
Visibility="{Binding IsOverlayerVisible, Converter={StaticResource {x:Static rs:ConverterKeys.FalseToCollapseConverter}}, RelativeSource={RelativeSource AncestorType=local:WindowX}, Mode=OneWay}" />
<Canvas x:Name="PART_ToastCanvas"
IsHitTestVisible="False" />
</Grid>
</Border>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -940,6 +946,8 @@
Visibility="Collapsed" />
<ContentControl Content="{TemplateBinding Overlayer}"
Visibility="{Binding IsOverlayerVisible, Converter={StaticResource {x:Static rs:ConverterKeys.FalseToCollapseConverter}}, RelativeSource={RelativeSource AncestorType=local:WindowX}, Mode=OneWay}" />
<Canvas x:Name="PART_ToastCanvas"
IsHitTestVisible="False" />
</Grid>
</Border>
<ControlTemplate.Triggers>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Windows;

namespace Panuon.WPF.UI.Configurations
{
public class ToastSetting
: DependencyObject
{
#region Ctor
public ToastSetting()
{
LabelStyle = (Style)Application.Current.FindResource(Toast.LabelStyleKey);
}
#endregion

#region Properties

#region LabelStyle
public Style LabelStyle
{
get { return (Style)GetValue(LabelStyleProperty); }
set { SetValue(LabelStyleProperty, value); }
}

public static readonly DependencyProperty LabelStyleProperty =
DependencyProperty.Register("LabelStyle", typeof(Style), typeof(ToastSetting));
#endregion

#region DefaultPosition
public ToastPosition DefaultPosition
{
get { return (ToastPosition)GetValue(DefaultPositionProperty); }
set { SetValue(DefaultPositionProperty, value); }
}

public static readonly DependencyProperty DefaultPositionProperty =
DependencyProperty.Register("DefaultPosition", typeof(ToastPosition), typeof(ToastSetting), new PropertyMetadata(ToastPosition.Bottom));
#endregion

#region Spacing
public double Spacing
{
get { return (double)GetValue(SpacingProperty); }
set { SetValue(SpacingProperty, value); }
}

public static readonly DependencyProperty SpacingProperty =
DependencyProperty.Register("Spacing", typeof(double), typeof(ToastSetting), new PropertyMetadata(20d));
#endregion

#region AnimationDuration
public TimeSpan AnimationDuration
{
get { return (TimeSpan)GetValue(AnimationDurationProperty); }
set { SetValue(AnimationDurationProperty, value); }
}

public static readonly DependencyProperty AnimationDurationProperty =
DependencyProperty.Register("AnimationDuration", typeof(TimeSpan), typeof(ToastSetting), new PropertyMetadata(TimeSpan.FromSeconds(0.5)));
#endregion

#region AnimationEasing
public AnimationEasing AnimationEasing
{
get { return (AnimationEasing)GetValue(AnimationEasingProperty); }
set { SetValue(AnimationEasingProperty, value); }
}

public static readonly DependencyProperty AnimationEasingProperty =
DependencyProperty.Register("AnimationEasing", typeof(AnimationEasing), typeof(ToastSetting), new PropertyMetadata(AnimationEasing.CircleOut));
#endregion

#endregion

}
}
Loading

0 comments on commit 2a6d561

Please sign in to comment.