Skip to content

Commit

Permalink
fix: fix ContextFlyout invalid issue & Simplify Button groups in Mess…
Browse files Browse the repository at this point in the history
…ageBox.
  • Loading branch information
zdpcdt committed Jan 9, 2025
1 parent d801736 commit 11e3024
Showing 1 changed file with 39 additions and 28 deletions.
67 changes: 39 additions & 28 deletions src/Ursa.Themes.Semi/Controls/MessageBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,35 @@
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 -->
<Design.PreviewWith>
<StackPanel Margin="20">
<u:MessageBoxControl
Content="此修改将不可逆"
MessageIcon="None"
Buttons="OK" />
<u:MessageBoxControl
Content="此修改将不可逆"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
Content="此修改将不可逆"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
MessageIcon="Warning"
Buttons="OKCancel" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type u:MessageBoxWindow}" TargetType="u:MessageBoxWindow">
<Setter Property="Title" Value="{x:Null}" />
<Setter Property="Background" Value="{DynamicResource SemiColorBackground2}" />
<Setter Property="Background" Value="{DynamicResource SemiColorBackground3}" />
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
Expand Down Expand Up @@ -87,20 +112,13 @@
<StackPanel
Grid.Row="2"
Margin="24,0,24,24"
Spacing="8"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Name="{x:Static u:MessageBoxWindow.PART_CancelButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxWindow.PART_NoButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxWindow.PART_YesButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxWindow.PART_OKButton}"
Margin="8,0,0,0" />
<Button Name="{x:Static u:MessageBoxControl.PART_CancelButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_NoButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_YesButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_OKButton}" />
</StackPanel>
</Grid>
</VisualLayerManager>
Expand Down Expand Up @@ -178,7 +196,7 @@
VerticalAlignment="Center"
Classes="Shadow"
ClipToBounds="False"
Background="{DynamicResource SemiColorBackground2}"
Background="{DynamicResource SemiColorBackground3}"
CornerRadius="{TemplateBinding CornerRadius}"
IsHitTestVisible="True"
Theme="{DynamicResource CardBorder}">
Expand Down Expand Up @@ -234,20 +252,13 @@
<StackPanel
Grid.Row="2"
Margin="24,0,24,24"
Spacing="8"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Name="{x:Static u:MessageBoxControl.PART_CancelButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxControl.PART_NoButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxControl.PART_YesButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxControl.PART_OKButton}"
Margin="8,0,0,0" />
<Button Name="{x:Static u:MessageBoxControl.PART_CancelButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_NoButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_YesButton}" />
<Button Name="{x:Static u:MessageBoxControl.PART_OKButton}" />
</StackPanel>
</Grid>
</Border>
Expand All @@ -257,7 +268,7 @@
<Style Selector="^ /template/ Panel#PART_TitleArea">
<Setter Property="ContextFlyout">
<MenuFlyout>
<MenuItem Command="{Binding $parent[u:CustomDialogControl].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem Command="{Binding $parent[u:MessageBoxControl].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Expand Down

0 comments on commit 11e3024

Please sign in to comment.