Merge pull request #657 from irihitech/popconfirm
New Control: PopConfirm
This commit is contained in:
135
src/Ursa.Themes.Semi/Controls/PopConfirm.axaml
Normal file
135
src/Ursa.Themes.Semi/Controls/PopConfirm.axaml
Normal file
@@ -0,0 +1,135 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared">
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme x:Key="{x:Type u:PopConfirm}"
|
||||
TargetType="u:PopConfirm">
|
||||
<Setter Property="Placement" Value="BottomEdgeAlignedLeft" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:PopConfirm">
|
||||
<Panel>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<Popup
|
||||
IsLightDismissEnabled="True"
|
||||
IsOpen="{Binding IsDropdownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
OverlayInputPassThroughElement="{Binding #PART_ContentPresenter}"
|
||||
Name="{x:Static u:PopConfirm.PART_Popup}"
|
||||
Placement="{TemplateBinding Placement}">
|
||||
<Border
|
||||
MaxWidth="{DynamicResource PopConfirmBorderMaxWidth}"
|
||||
Padding="{DynamicResource PopConfirmBorderPadding}"
|
||||
Margin="{DynamicResource PopConfirmBorderMargin}"
|
||||
Background="{DynamicResource PopConfirmBackground}"
|
||||
BorderBrush="{DynamicResource PopConfirmBorderBrush}"
|
||||
BorderThickness="{DynamicResource PopConfirmBorderThickness}"
|
||||
CornerRadius="{DynamicResource PopConfirmBorderCornerRadius}"
|
||||
BoxShadow="{DynamicResource PopConfirmBorderBoxShadows}">
|
||||
<Grid
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RowDefinitions="*, Auto"
|
||||
ColumnDefinitions="Auto, *, Auto">
|
||||
<!-- Icon Area -->
|
||||
<Panel
|
||||
Grid.Column="0"
|
||||
Margin="{DynamicResource PopConfirmIconMargin}"
|
||||
VerticalAlignment="Top">
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Icon}" />
|
||||
<PathIcon
|
||||
Name="PART_BuildInIcon"
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
Classes="ExtraLarge"
|
||||
Data="{DynamicResource BannerWarningIconGeometry}"
|
||||
Foreground="{DynamicResource BannerWarningBorderBrush}"
|
||||
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNull}}" />
|
||||
</Panel>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Spacing="8">
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding PopupHeader}"
|
||||
ContentTemplate="{TemplateBinding PopupHeaderTemplate}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextElement.FontSize="{DynamicResource PopConfirmTitleFontSize}"
|
||||
TextElement.FontWeight="{DynamicResource PopConfirmTitleFontWeight}" />
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding PopupContent}"
|
||||
ContentTemplate="{TemplateBinding PopupContentTemplate}"
|
||||
Foreground="{DynamicResource PopConfirmContentForeground}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<Button
|
||||
Name="{x:Static u:PopConfirm.PART_CloseButton}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Theme="{DynamicResource OverlayCloseButton}"
|
||||
Command="{TemplateBinding CancelCommand}"
|
||||
CommandParameter="{TemplateBinding CancelCommandParameter}" />
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="0 25 0 0"
|
||||
Spacing="8"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button
|
||||
Name="{x:Static u:PopConfirm.PART_CancelButton}"
|
||||
Content="{DynamicResource STRING_MENU_DIALOG_CANCEL}"
|
||||
Command="{TemplateBinding CancelCommand}"
|
||||
CommandParameter="{TemplateBinding CancelCommandParameter}" />
|
||||
<Button
|
||||
Name="{x:Static u:PopConfirm.PART_ConfirmButton}"
|
||||
Theme="{DynamicResource SolidButton}"
|
||||
Content="{DynamicResource STRING_MENU_DIALOG_OK}"
|
||||
Command="{TemplateBinding ConfirmCommand}"
|
||||
CommandParameter="{TemplateBinding ConfirmCommandParameter}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^ /template/ Button#PART_CancelButton">
|
||||
<Setter Property="helpers:ClassHelper.Classes" Value="Tertiary" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^ /template/ Button#PART_ConfirmButton">
|
||||
<Setter Property="helpers:ClassHelper.Classes" Value="Primary" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Information">
|
||||
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
|
||||
<Setter Property="Data" Value="{DynamicResource BannerInformationIconGeometry}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource BannerInformationBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Success">
|
||||
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
|
||||
<Setter Property="Data" Value="{DynamicResource BannerSuccessIconGeometry}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource BannerSuccessBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Warning">
|
||||
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
|
||||
<Setter Property="Data" Value="{DynamicResource BannerWarningIconGeometry}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource BannerWarningBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Error">
|
||||
<Style Selector="^ /template/ PathIcon#PART_BuildInIcon">
|
||||
<Setter Property="Data" Value="{DynamicResource BannerErrorIconGeometry}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource BannerErrorBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -36,26 +36,27 @@
|
||||
<ResourceInclude Source="NumPad.axaml" />
|
||||
<ResourceInclude Source="NumberDisplayer.axaml" />
|
||||
<ResourceInclude Source="Pagination.axaml" />
|
||||
<ResourceInclude Source="PathPicker.axaml"/>
|
||||
<ResourceInclude Source="PinCode.axaml" />
|
||||
<ResourceInclude Source="PopConfirm.axaml" />
|
||||
<ResourceInclude Source="RangeSlider.axaml" />
|
||||
<ResourceInclude Source="Rating.axaml" />
|
||||
<ResourceInclude Source="Resizer.axaml" />
|
||||
<ResourceInclude Source="ScrollToButton.axaml" />
|
||||
<ResourceInclude Source="SelectionList.axaml" />
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
<ResourceInclude Source="SplashWindow.axaml"/>
|
||||
<ResourceInclude Source="TagInput.axaml" />
|
||||
<ResourceInclude Source="ThemeSelector.axaml" />
|
||||
<ResourceInclude Source="TimePicker.axaml" />
|
||||
<ResourceInclude Source="TimeRangePicker.axaml" />
|
||||
<ResourceInclude Source="Timeline.axaml" />
|
||||
<ResourceInclude Source="TreeComboBox.axaml"/>
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
<ResourceInclude Source="TwoTonePathIcon.axaml" />
|
||||
<ResourceInclude Source="Toast.axaml" />
|
||||
<ResourceInclude Source="ToolBar.axaml" />
|
||||
<ResourceInclude Source="TimeBox.axaml"/>
|
||||
<ResourceInclude Source="UrsaView.axaml" />
|
||||
<ResourceInclude Source="UrsaWindow.axaml"/>
|
||||
<ResourceInclude Source="PinCode.axaml" />
|
||||
<ResourceInclude Source="PathPicker.axaml"/>
|
||||
<ResourceInclude Source="SplashWindow.axaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
6
src/Ursa.Themes.Semi/Themes/Dark/PopConfirm.axaml
Normal file
6
src/Ursa.Themes.Semi/Themes/Dark/PopConfirm.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SolidColorBrush x:Key="PopConfirmBackground">#43444A</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PopConfirmBorderBrush" Opacity="0.08" Color="White" />
|
||||
<SolidColorBrush x:Key="PopConfirmContentForeground" Opacity="0.6" Color="#F9F9F9" />
|
||||
<BoxShadows x:Key="PopConfirmBorderBoxShadows">inset 0 0 0 1 #1AFFFFFF, 0 4 14 #40000000</BoxShadows>
|
||||
</ResourceDictionary>
|
||||
@@ -15,6 +15,7 @@
|
||||
<ResourceInclude Source="NavigationMenu.axaml" />
|
||||
<ResourceInclude Source="NotificationShared.axaml" />
|
||||
<ResourceInclude Source="Pagination.axaml" />
|
||||
<ResourceInclude Source="PopConfirm.axaml" />
|
||||
<ResourceInclude Source="Rating.axaml" />
|
||||
<ResourceInclude Source="SelectionList.axaml" />
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
|
||||
6
src/Ursa.Themes.Semi/Themes/Light/PopConfirm.axaml
Normal file
6
src/Ursa.Themes.Semi/Themes/Light/PopConfirm.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SolidColorBrush x:Key="PopConfirmBackground">White</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PopConfirmBorderBrush" Opacity="0.08" Color="#1C1F23" />
|
||||
<SolidColorBrush x:Key="PopConfirmContentForeground" Opacity="0.62" Color="#1C1F23" />
|
||||
<BoxShadows x:Key="PopConfirmBorderBoxShadows">0 0 1 #4A000000, 0 4 14 #1A000000</BoxShadows>
|
||||
</ResourceDictionary>
|
||||
@@ -15,6 +15,7 @@
|
||||
<ResourceInclude Source="NavigationMenu.axaml" />
|
||||
<ResourceInclude Source="NotificationShared.axaml" />
|
||||
<ResourceInclude Source="Pagination.axaml" />
|
||||
<ResourceInclude Source="PopConfirm.axaml" />
|
||||
<ResourceInclude Source="Rating.axaml" />
|
||||
<ResourceInclude Source="SelectionList.axaml" />
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
|
||||
11
src/Ursa.Themes.Semi/Themes/Shared/PopConfirm.axaml
Normal file
11
src/Ursa.Themes.Semi/Themes/Shared/PopConfirm.axaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<x:Double x:Key="PopConfirmBorderMaxWidth">400</x:Double>
|
||||
<Thickness x:Key="PopConfirmBorderPadding">20 24 24 24</Thickness>
|
||||
<Thickness x:Key="PopConfirmBorderMargin">4</Thickness>
|
||||
<Thickness x:Key="PopConfirmBorderThickness">1</Thickness>
|
||||
<CornerRadius x:Key="PopConfirmBorderCornerRadius">6</CornerRadius>
|
||||
<Thickness x:Key="PopConfirmIconMargin">0 0 12 0</Thickness>
|
||||
<x:Double x:Key="PopConfirmTitleFontSize">16</x:Double>
|
||||
<FontWeight x:Key="PopConfirmTitleFontWeight">600</FontWeight>
|
||||
</ResourceDictionary>
|
||||
@@ -16,8 +16,9 @@
|
||||
<ResourceInclude Source="NavigationMenu.axaml" />
|
||||
<ResourceInclude Source="Notification.axaml" />
|
||||
<ResourceInclude Source="Pagination.axaml" />
|
||||
<ResourceInclude Source="PopConfirm.axaml" />
|
||||
<ResourceInclude Source="Rating.axaml" />
|
||||
<ResourceInclude Source="Resizer.axaml"/>
|
||||
<ResourceInclude Source="Resizer.axaml" />
|
||||
<ResourceInclude Source="ScrollToButton.axaml" />
|
||||
<ResourceInclude Source="TagInput.axaml" />
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
|
||||
Reference in New Issue
Block a user