Instantly share code, notes, and snippets.
Created
July 30, 2021 19:02
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save Infarh/f520a5712493578dbf6084f3ac86d316 to your computer and use it in GitHub Desktop.
ConfirmButtonStyle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using System.Windows.Media; | |
using System.Windows.Controls; | |
using System.Windows.Controls.Primitives; | |
namespace LocalNamespace | |
{ | |
public class ConfirmButton | |
{ | |
#region Attached property PopupPlacment : PlacementMode - Положение выпадающего меню | |
/// <summary>Положение выпадающего меню</summary> | |
public static readonly DependencyProperty PopupPlacemenProperty = | |
DependencyProperty.RegisterAttached( | |
"PopupPlacemen", | |
typeof(PlacementMode), | |
typeof(ConfirmButton), | |
new PropertyMetadata(PlacementMode.Right)); | |
/// <summary>Положение выпадающего меню</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetPopupPlacemen(DependencyObject element, PlacementMode value) => element.SetValue(PopupPlacemenProperty, value); | |
/// <summary>Положение выпадающего меню</summary> | |
public static PlacementMode GetPopupPlacemen(DependencyObject element) => (PlacementMode)element.GetValue(PopupPlacemenProperty); | |
#endregion | |
#region Attached property Animation : PopupAnimation - Анимация открытия | |
/// <summary>Анимация открытия</summary> | |
public static readonly DependencyProperty AnimationProperty = | |
DependencyProperty.RegisterAttached( | |
"Animation", | |
typeof(PopupAnimation), | |
typeof(ConfirmButton), | |
new PropertyMetadata(PopupAnimation.Fade)); | |
/// <summary>Анимация открытия</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetAnimation(DependencyObject element, PopupAnimation value) => element.SetValue(AnimationProperty, value); | |
/// <summary>Анимация открытия</summary> | |
public static PopupAnimation GetAnimation(DependencyObject element) => (PopupAnimation)element.GetValue(AnimationProperty); | |
#endregion | |
#region Attached property HorizontalPopupOffset : double - Горизонтальное расстояние выпадающего меню | |
/// <summary>Горизонтальное расстояние выпадающего меню</summary> | |
public static readonly DependencyProperty HorizontalPopupOffsetProperty = | |
DependencyProperty.RegisterAttached( | |
"HorizontalPopupOffset", | |
typeof(double), | |
typeof(ConfirmButton), | |
new PropertyMetadata(0d)); | |
/// <summary>Горизонтальное расстояние выпадающего меню</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetHorizontalPopupOffset(DependencyObject element, double value) => element.SetValue(HorizontalPopupOffsetProperty, value); | |
/// <summary>Горизонтальное расстояние выпадающего меню</summary> | |
public static double GetHorizontalPopupOffset(DependencyObject element) => (double)element.GetValue(HorizontalPopupOffsetProperty); | |
#endregion | |
#region Attached property VerticalPopupOffset : double - Вертикальное расстояние выпадающего меню | |
/// <summary>Вертикальное расстояние выпадающего меню</summary> | |
public static readonly DependencyProperty VerticalPopupOffsetProperty = | |
DependencyProperty.RegisterAttached( | |
"VerticalPopupOffset", | |
typeof(double), | |
typeof(ConfirmButton), | |
new PropertyMetadata(0d)); | |
/// <summary>Вертикальное расстояние выпадающего меню</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetVerticalPopupOffset(DependencyObject element, double value) => element.SetValue(VerticalPopupOffsetProperty, value); | |
/// <summary>Вертикальное расстояние выпадающего меню</summary> | |
public static double GetVerticalPopupOffset(DependencyObject element) => (double)element.GetValue(VerticalPopupOffsetProperty); | |
#endregion | |
#region Attached property Content : object - Содержимое кнопки подтверждения | |
/// <summary>Содержимое кнопки подтверждения</summary> | |
public static readonly DependencyProperty ContentProperty = | |
DependencyProperty.RegisterAttached( | |
"Content", | |
typeof(object), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(object))); | |
/// <summary>Содержимое кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetContent(DependencyObject element, object value) => element.SetValue(ContentProperty, value); | |
/// <summary>Содержимое кнопки подтверждения</summary> | |
public static object GetContent(DependencyObject element) => (object)element.GetValue(ContentProperty); | |
#endregion | |
#region Attached property ConfirmButtonMargin : Thickness - Отступы кнопки подтвеждения | |
/// <summary>Отступы кнопки подтвеждения</summary> | |
public static readonly DependencyProperty ConfirmButtonMarginProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonMargin", | |
typeof(Thickness), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Thickness))); | |
/// <summary>Отступы кнопки подтвеждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonMargin(DependencyObject element, Thickness value) => element.SetValue(ConfirmButtonMarginProperty, value); | |
/// <summary>Отступы кнопки подтвеждения</summary> | |
public static Thickness GetConfirmButtonMargin(DependencyObject element) => (Thickness)element.GetValue(ConfirmButtonMarginProperty); | |
#endregion | |
#region Attached property ConfirmButtonPadding : Thickness - Внутренние отступы кнопки подтверждения | |
/// <summary>Внутренние отступы кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonPaddingProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonPadding", | |
typeof(Thickness), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Thickness))); | |
/// <summary>Внутренние отступы кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonPadding(DependencyObject element, Thickness value) => element.SetValue(ConfirmButtonPaddingProperty, value); | |
/// <summary>Внутренние отступы кнопки подтверждения</summary> | |
public static Thickness GetConfirmButtonPadding(DependencyObject element) => (Thickness)element.GetValue(ConfirmButtonPaddingProperty); | |
#endregion | |
#region Attached property ConfirmButtonVerticalAligment : VerticalAlignment - Вертикальное размещение кнопки подтверждения | |
/// <summary>Вертикальное размещение кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonVerticalAlignmentProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonVerticalAlignment", | |
typeof(VerticalAlignment), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(VerticalAlignment))); | |
/// <summary>Вертикальное размещение кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonVerticalAlignment(DependencyObject element, VerticalAlignment value) => element.SetValue(ConfirmButtonVerticalAlignmentProperty, value); | |
/// <summary>Вертикальное размещение кнопки подтверждения</summary> | |
public static VerticalAlignment GetConfirmButtonVerticalAlignment(DependencyObject element) => (VerticalAlignment)element.GetValue(ConfirmButtonVerticalAlignmentProperty); | |
#endregion | |
#region Attached property ConfirmButtonHorizontalAligment : HorizontalAlignment - Горизонтальное размещение кнопки подтверждения | |
/// <summary>Горизонтальное размещение кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonHorizontalAligmentProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonHorizontalAligment", | |
typeof(HorizontalAlignment), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(HorizontalAlignment))); | |
/// <summary>Горизонтальное размещение кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonHorizontalAligment(DependencyObject element, HorizontalAlignment value) => element.SetValue(ConfirmButtonHorizontalAligmentProperty, value); | |
/// <summary>Горизонтальное размещение кнопки подтверждения</summary> | |
public static HorizontalAlignment GetConfirmButtonHorizontalAligment(DependencyObject element) => (HorizontalAlignment)element.GetValue(ConfirmButtonHorizontalAligmentProperty); | |
#endregion | |
#region Attached property ConfirmButtonForeground : Brush - Кисть для рисования контента кнопки подтверждения | |
/// <summary>Кисть для рисования контента кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonForegroundProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonForeground", | |
typeof(Brush), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Brush))); | |
/// <summary>Кисть для рисования контента кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonForeground(DependencyObject element, Brush value) => element.SetValue(ConfirmButtonForegroundProperty, value); | |
/// <summary>Кисть для рисования контента кнопки подтверждения</summary> | |
public static Brush GetConfirmButtonForeground(DependencyObject element) => (Brush)element.GetValue(ConfirmButtonForegroundProperty); | |
#endregion | |
#region Attached property ConfirmButtonBackground : Brush - Кисть для рисования фона кнопки подтверждения | |
/// <summary>Кисть для рисования фона кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonBackgroundProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonBackground", | |
typeof(Brush), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Brush))); | |
/// <summary>Кисть для рисования фона кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonBackground(DependencyObject element, Brush value) => element.SetValue(ConfirmButtonBackgroundProperty, value); | |
/// <summary>Кисть для рисования фона кнопки подтверждения</summary> | |
public static Brush GetConfirmButtonBackground(DependencyObject element) => (Brush)element.GetValue(ConfirmButtonBackgroundProperty); | |
#endregion | |
#region Attached property ConfirmButtonBorderBrush : Brush - Кисть для рисования рамки кнопки подтвеждения | |
/// <summary>Кисть для рисования рамки кнопки подтвеждения</summary> | |
public static readonly DependencyProperty ConfirmButtonBorderBrushProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonBorderBrush", | |
typeof(Brush), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Brush))); | |
/// <summary>Кисть для рисования рамки кнопки подтвеждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonBorderBrush(DependencyObject element, Brush value) => element.SetValue(ConfirmButtonBorderBrushProperty, value); | |
/// <summary>Кисть для рисования рамки кнопки подтвеждения</summary> | |
public static Brush GetConfirmButtonBorderBrush(DependencyObject element) => (Brush)element.GetValue(ConfirmButtonBorderBrushProperty); | |
#endregion | |
#region Attached property ConfirmButtonBorderThickness : Thickness - Толщина рамки кнопки подтверждения | |
/// <summary>Толщина рамки кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonBorderThicknessProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonBorderThickness", | |
typeof(Thickness), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(Thickness))); | |
/// <summary>Толщина рамки кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonBorderThickness(DependencyObject element, Thickness value) => element.SetValue(ConfirmButtonBorderThicknessProperty, value); | |
/// <summary>Толщина рамки кнопки подтверждения</summary> | |
public static Thickness GetConfirmButtonBorderThickness(DependencyObject element) => (Thickness)element.GetValue(ConfirmButtonBorderThicknessProperty); | |
#endregion | |
#region Attached property ConfirmButtonCornerRadius : CornerRadius - Радиус скругления рамки кнопки подтверждения | |
/// <summary>Радиус скругления рамки кнопки подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonCornerRadiusProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonCornerRadius", | |
typeof(CornerRadius), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(CornerRadius))); | |
/// <summary>Радиус скругления рамки кнопки подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonCornerRadius(DependencyObject element, CornerRadius value) => element.SetValue(ConfirmButtonCornerRadiusProperty, value); | |
/// <summary>Радиус скругления рамки кнопки подтверждения</summary> | |
public static CornerRadius GetConfirmButtonCornerRadius(DependencyObject element) => (CornerRadius)element.GetValue(ConfirmButtonCornerRadiusProperty); | |
#endregion | |
#region Attached property ConfirmButtonFontWeight : FontWeight - Толщина шрифта на кнопке подтверждения | |
/// <summary>Толщина шрифта на кнопке подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonFontWeightProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonFontWeight", | |
typeof(FontWeight), | |
typeof(ConfirmButton), | |
new PropertyMetadata(default(FontWeight))); | |
/// <summary>Толщина шрифта на кнопке подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonFontWeight(DependencyObject element, FontWeight value) => element.SetValue(ConfirmButtonFontWeightProperty, value); | |
/// <summary>Толщина шрифта на кнопке подтверждения</summary> | |
public static FontWeight GetConfirmButtonFontWeight(DependencyObject element) => (FontWeight)element.GetValue(ConfirmButtonFontWeightProperty); | |
#endregion | |
#region Attached property ConfirmButtonFontSize : double - Размер шрифта на кнопке подтверждения | |
/// <summary>Размер шрифта на кнопке подтверждения</summary> | |
public static readonly DependencyProperty ConfirmButtonFontSizeProperty = | |
DependencyProperty.RegisterAttached( | |
"ConfirmButtonFontSize", | |
typeof(double), | |
typeof(ConfirmButton), | |
new PropertyMetadata(12d)); | |
/// <summary>Размер шрифта на кнопке подтверждения</summary> | |
[AttachedPropertyBrowsableForType(typeof(Button))] | |
public static void SetConfirmButtonFontSize(DependencyObject element, double value) => element.SetValue(ConfirmButtonFontSizeProperty, value); | |
/// <summary>Размер шрифта на кнопке подтверждения</summary> | |
public static double GetConfirmButtonFontSize(DependencyObject element) => (double)element.GetValue(ConfirmButtonFontSizeProperty); | |
#endregion | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:l="clr-namespace:LocalNamespace"> | |
<SolidColorBrush x:Key="TransparentBrush" Color="Transparent"/> | |
<SolidColorBrush x:Key="BlackBrush" Color="Black"/> | |
<SolidColorBrush x:Key="WhiteBrush" Color="White"/> | |
<SolidColorBrush x:Key="RedBrush" Color="Red"/> | |
<SolidColorBrush x:Key="GreenBrush" Color="Green"/> | |
<SolidColorBrush x:Key="BlueBrush" Color="Blue"/> | |
<CubicEase x:Key="CubicEasingInOutFunction" EasingMode="EaseInOut"/> | |
<Color x:Key="ConfirmButton.ConfirmForegroundColor">OrangeRed</Color> | |
<Color x:Key="ConfirmButton.ConfirmBackgroundColor">WhiteSmoke</Color> | |
<Color x:Key="ConfirmButton.ConfirmBorderColor">Red</Color> | |
<SolidColorBrush x:Key="ConfirmButton.ConfirmForegroundBrush" Color="{StaticResource ConfirmButton.ConfirmForegroundColor}"/> | |
<SolidColorBrush x:Key="ConfirmButton.ConfirmBackgroundBrush" Color="{StaticResource ConfirmButton.ConfirmBackgroundColor}" /> | |
<SolidColorBrush x:Key="ConfirmButton.ConfirmBorderBrush" Color="{StaticResource ConfirmButton.ConfirmBorderColor}" /> | |
<Storyboard x:Key="ConfirmButton.MouseEnterAnimation" RepeatBehavior="Forever" AutoReverse="True"> | |
<ColorAnimation Storyboard.TargetName="ConfirmButtonBorder" | |
Storyboard.TargetProperty="Background.(SolidColorBrush.Color)" | |
To="{StaticResource ConfirmButton.ConfirmForegroundColor}" | |
Duration="0:0:0.5" | |
EasingFunction="{StaticResource CubicEasingInOutFunction}"/> | |
<ColorAnimation Storyboard.TargetName="Content" | |
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" | |
To="{StaticResource ConfirmButton.ConfirmBackgroundColor}" | |
Duration="0:0:0.5" | |
EasingFunction="{StaticResource CubicEasingInOutFunction}"/> | |
</Storyboard> | |
<Storyboard x:Key="ConfirmButton.MouseExitAnimation"> | |
<ColorAnimation Storyboard.TargetName="ConfirmButtonBorder" | |
Storyboard.TargetProperty="Background.(SolidColorBrush.Color)" | |
From="{StaticResource ConfirmButton.ConfirmForegroundColor}" | |
Duration="0:0:0.25" | |
EasingFunction="{StaticResource CubicEasingInOutFunction}"/> | |
<ColorAnimation Storyboard.TargetName="Content" | |
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" | |
From="{StaticResource ConfirmButton.ConfirmBackgroundColor}" | |
Duration="0:0:0.25" | |
EasingFunction="{StaticResource CubicEasingInOutFunction}"/> | |
</Storyboard> | |
<ControlTemplate x:Key="ConfirmButton.ToggleButtonTemplate" TargetType="{x:Type ToggleButton}" > | |
</ControlTemplate> | |
<ControlTemplate x:Key="ConfirmButton.ConfirmButtonTemplate" TargetType="{x:Type Button}" > | |
<Border Name="ConfirmButtonBorder" | |
CornerRadius="{TemplateBinding l:ConfirmButton.ConfirmButtonCornerRadius}" | |
BorderBrush="{TemplateBinding BorderBrush}" | |
BorderThickness="{TemplateBinding BorderThickness}" | |
Background="{TemplateBinding Background}" | |
Padding="{TemplateBinding Padding}" | |
Margin="{TemplateBinding Margin}"> | |
<ContentPresenter Name="Content" ContentSource="Content" | |
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |
TextBlock.FontWeight="{TemplateBinding l:ConfirmButton.ConfirmButtonFontWeight}" | |
TextBlock.FontSize="{TemplateBinding l:ConfirmButton.ConfirmButtonFontSize}"/> | |
</Border> | |
<ControlTemplate.Triggers> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Trigger.EnterActions> | |
<BeginStoryboard Storyboard="{StaticResource ConfirmButton.MouseEnterAnimation}"/> | |
</Trigger.EnterActions> | |
<Trigger.ExitActions> | |
<BeginStoryboard Storyboard="{StaticResource ConfirmButton.MouseExitAnimation}"/> | |
</Trigger.ExitActions> | |
</Trigger> | |
</ControlTemplate.Triggers> | |
</ControlTemplate> | |
<ControlTemplate x:Key="ConfirmButtonTemplate" TargetType="{x:Type Button}" > | |
<Grid> | |
<ToggleButton Name="ToggleButton" | |
Content="{TemplateBinding Content}" | |
Padding="{TemplateBinding Padding}" | |
Background="{TemplateBinding Background}" | |
BorderThickness="{TemplateBinding BorderThickness}" | |
BorderBrush="{TemplateBinding BorderBrush}" | |
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> | |
<Popup Name="Popup" | |
IsOpen="{Binding IsChecked, ElementName=ToggleButton}" | |
StaysOpen="False" | |
Placement="{TemplateBinding l:ConfirmButton.PopupPlacemen}" | |
PopupAnimation="{TemplateBinding l:ConfirmButton.Animation}" | |
HorizontalOffset="{TemplateBinding l:ConfirmButton.HorizontalPopupOffset}" | |
VerticalOffset="{TemplateBinding l:ConfirmButton.VerticalPopupOffset}" | |
AllowsTransparency="True"> | |
<Button Name="ConfirmButton" | |
Template="{StaticResource ConfirmButton.ConfirmButtonTemplate}" | |
Content="{TemplateBinding l:ConfirmButton.Content}" | |
Margin="{TemplateBinding l:ConfirmButton.ConfirmButtonMargin}" | |
Padding="{TemplateBinding l:ConfirmButton.ConfirmButtonPadding}" | |
VerticalAlignment="{TemplateBinding l:ConfirmButton.ConfirmButtonVerticalAlignment}" | |
Background="{TemplateBinding l:ConfirmButton.ConfirmButtonBackground}" | |
Foreground="{TemplateBinding l:ConfirmButton.ConfirmButtonForeground}" | |
BorderBrush="{TemplateBinding l:ConfirmButton.ConfirmButtonBorderBrush}" | |
BorderThickness="{TemplateBinding l:ConfirmButton.ConfirmButtonBorderThickness}" | |
Command="{TemplateBinding Command}" | |
CommandParameter="{TemplateBinding CommandParameter}" | |
CommandTarget="{TemplateBinding CommandTarget}" | |
HorizontalContentAlignment="Center" | |
l:ConfirmButton.ConfirmButtonCornerRadius="{TemplateBinding l:ConfirmButton.ConfirmButtonCornerRadius}" | |
l:ConfirmButton.ConfirmButtonFontWeight="{TemplateBinding l:ConfirmButton.ConfirmButtonFontWeight}" | |
l:ConfirmButton.ConfirmButtonFontSize="{TemplateBinding l:ConfirmButton.ConfirmButtonFontSize}"/> | |
</Popup> | |
</Grid> | |
<ControlTemplate.Triggers> | |
<Trigger SourceName="Popup" Property="Placement" Value="Top"> | |
<Setter TargetName="Popup" Property="Margin" Value="0,0,0,2"/> | |
</Trigger> | |
<Trigger SourceName="Popup" Property="Placement" Value="Bottom"> | |
<Setter TargetName="Popup" Property="Margin" Value="0,2,0,0"/> | |
</Trigger> | |
<Trigger SourceName="Popup" Property="Placement" Value="Right"> | |
<Setter TargetName="Popup" Property="Margin" Value="0,0,2,0"/> | |
</Trigger> | |
<Trigger SourceName="Popup" Property="Placement" Value="Left"> | |
<Setter TargetName="Popup" Property="Margin" Value="2,0,0,0"/> | |
</Trigger> | |
<Trigger Property="IsDefault" Value="True"> | |
<Setter TargetName="ToggleButton" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> | |
<Setter TargetName="ToggleButton" Property="BorderThickness" Value="2"/> | |
<Setter Property="FontWeight" Value="Bold"/> | |
</Trigger> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter TargetName="ToggleButton" Property="Background" Value="WhiteSmoke"/> | |
<Setter TargetName="ToggleButton" Property="BorderBrush" Value="DarkBlue"/> | |
</Trigger> | |
<Trigger Property="IsPressed" Value="True"> | |
<Setter TargetName="ToggleButton" Property="Background" Value="LightSkyBlue"/> | |
<Setter TargetName="ToggleButton" Property="BorderBrush" Value="Fuchsia"/> | |
</Trigger> | |
</ControlTemplate.Triggers> | |
</ControlTemplate> | |
<Style x:Key="ConfirmButtonStyle" TargetType="{x:Type Button}"> | |
<Setter Property="l:ConfirmButton.Animation" Value="Fade"/> | |
<Setter Property="l:ConfirmButton.PopupPlacemen" Value="Right"/> | |
<Setter Property="l:ConfirmButton.HorizontalPopupOffset" Value="0"/> | |
<Setter Property="l:ConfirmButton.VerticalPopupOffset" Value="0"/> | |
<Setter Property="l:ConfirmButton.Content" Value="Подтверждаете?"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonMargin" Value="1"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonPadding" Value="4"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonVerticalAlignment" Value="Center"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonForeground" Value="{StaticResource ConfirmButton.ConfirmForegroundBrush}"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonBackground" Value="{StaticResource ConfirmButton.ConfirmBackgroundBrush}"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonBorderBrush" Value="{StaticResource ConfirmButton.ConfirmBorderBrush}"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonBorderThickness" Value="1"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonCornerRadius" Value="5"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonFontWeight" Value="Bold"/> | |
<Setter Property="l:ConfirmButton.ConfirmButtonFontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}"/> | |
<Setter Property="Template" Value="{StaticResource ConfirmButtonTemplate}"/> | |
</Style> | |
</ResourceDictionary> |
Author
Infarh
commented
Jul 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment