Skip to content

Commit fd78972

Browse files
committed
Improve OK MessageBoxEx display style
1 parent ab087bd commit fd78972

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

Flow.Launcher.Core/MessageBoxEx.xaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@
6060
</Grid>
6161
</StackPanel>
6262
</StackPanel>
63-
<StackPanel Grid.Row="1" Margin="30 0 30 24">
64-
<Grid Grid.Column="0" Margin="0 0 0 12">
63+
<Grid Grid.Row="1" Margin="30 0 30 24">
64+
<Grid.RowDefinitions>
65+
<RowDefinition Height="Auto" />
66+
<RowDefinition Height="Auto" />
67+
</Grid.RowDefinitions>
68+
<Grid Grid.Row="0" Margin="0 0 0 12">
6569
<Grid.ColumnDefinitions>
6670
<ColumnDefinition Width="Auto" />
6771
<ColumnDefinition Width="*" />
@@ -91,14 +95,25 @@
9195
</Grid>
9296
<TextBlock
9397
x:Name="DescTextBlock"
94-
Grid.Column="1"
98+
Grid.Row="1"
9599
MaxWidth="400"
96100
Margin="0 0 26 0"
97101
HorizontalAlignment="Stretch"
98102
FontSize="14"
99103
TextAlignment="Left"
100104
TextWrapping="Wrap" />
101-
</StackPanel>
105+
<TextBlock
106+
x:Name="DescOnlyTextBlock"
107+
Grid.Row="0"
108+
Grid.RowSpan="2"
109+
MaxWidth="400"
110+
Margin="0 0 26 0"
111+
HorizontalAlignment="Stretch"
112+
VerticalAlignment="Center"
113+
FontSize="14"
114+
TextAlignment="Left"
115+
TextWrapping="Wrap" />
116+
</Grid>
102117
<Border
103118
Grid.Row="2"
104119
Margin="0 0 0 0"

Flow.Launcher.Core/MessageBoxEx.xaml.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public enum MessageBoxImage
3939
/// 1 parameter
4040
public static MessageBoxResult Show(string messageBoxText)
4141
{
42-
return Show(string.Empty, messageBoxText, MessageBoxButton.OK, MessageBoxImage.None);
42+
return Show(messageBoxText, string.Empty, MessageBoxButton.OK, MessageBoxImage.None);
4343
}
4444

4545
// 2 parameter
@@ -80,11 +80,19 @@ public static MessageBoxResult Show(string messageBoxText, string title, Message
8080
public static MessageBoxResult Show(string messageBoxText, string title, MessageBoxButton button, MessageBoxImage image)
8181
{
8282
msgBox = new MessageBoxEx();
83-
msgBox.TitleTextBlock.Text = title;
84-
msgBox.DescTextBlock.Text = messageBoxText;
85-
msgBox.Title = title;
83+
if (title == string.Empty && button == MessageBoxButton.OK && image == MessageBoxImage.None)
84+
{
85+
msgBox.DescOnlyTextBlock.Text = messageBoxText;
86+
msgBox.Title = messageBoxText;
87+
}
88+
else
89+
{
90+
msgBox.TitleTextBlock.Text = title;
91+
msgBox.DescTextBlock.Text = messageBoxText;
92+
msgBox.Title = title;
93+
SetImageOfMessageBox(image);
94+
}
8695
SetVisibilityOfButtons(button);
87-
SetImageOfMessageBox(image);
8896
msgBox.ShowDialog();
8997
return _result;
9098
}

0 commit comments

Comments
 (0)