Skip to content

Commit 7b9cc90

Browse files
committed
Merge pull request #1793 from MahApps/1755-fix-preservetext-in-dialogs
fix preservetext for buttons in dialogs
2 parents 7e9a835 + b98f636 commit 7b9cc90

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

MahApps.Metro/Controls/Dialogs/InputDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private void Dialog_Loaded(object sender, RoutedEventArgs e)
117117
switch (this.DialogSettings.ColorScheme)
118118
{
119119
case MetroDialogColorScheme.Accented:
120-
this.PART_NegativeButton.Style = this.FindResource("HighlightedSquareButtonStyle") as Style;
120+
this.PART_NegativeButton.Style = this.FindResource("AccentedDialogHighlightedSquareButton") as Style;
121121
PART_TextBox.SetResourceReference(ForegroundProperty, "BlackColorBrush");
122122
break;
123123
}

MahApps.Metro/Controls/Dialogs/LoginDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void Dialog_Loaded(object sender, RoutedEventArgs e)
158158
switch (this.DialogSettings.ColorScheme)
159159
{
160160
case MetroDialogColorScheme.Accented:
161-
this.PART_NegativeButton.Style = this.FindResource("HighlightedSquareButtonStyle") as Style;
161+
this.PART_NegativeButton.Style = this.FindResource("AccentedDialogHighlightedSquareButton") as Style;
162162
PART_TextBox.SetResourceReference(ForegroundProperty, "BlackColorBrush");
163163
PART_TextBox2.SetResourceReference(ForegroundProperty, "BlackColorBrush");
164164
break;

MahApps.Metro/Controls/Dialogs/MessageDialog.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ private static void SetButtonState(MessageDialog md)
203203
switch (md.DialogSettings.ColorScheme)
204204
{
205205
case MetroDialogColorScheme.Accented:
206-
md.PART_NegativeButton.Style = md.FindResource("HighlightedSquareButtonStyle") as Style;
207-
md.PART_FirstAuxiliaryButton.Style = md.FindResource("HighlightedSquareButtonStyle") as Style;
208-
md.PART_SecondAuxiliaryButton.Style = md.FindResource("HighlightedSquareButtonStyle") as Style;
206+
md.PART_NegativeButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
207+
md.PART_FirstAuxiliaryButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
208+
md.PART_SecondAuxiliaryButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
209209
break;
210210
}
211211
}

MahApps.Metro/Themes/Dialogs/BaseMetroDialog.xaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@
1010

1111
<Style BasedOn="{StaticResource SquareButtonStyle}"
1212
TargetType="{x:Type Button}">
13-
<Setter Property="controls:ButtonHelper.PreserveTextCase"
13+
<Setter Property="controls:ButtonHelper.PreserveTextCase"
1414
Value="True" />
1515
</Style>
1616

1717
<Style x:Key="AccentedDialogSquareButton"
1818
BasedOn="{StaticResource AccentedSquareButtonStyle}"
1919
TargetType="{x:Type Button}">
20-
<Setter Property="controls:ButtonHelper.PreserveTextCase"
20+
<Setter Property="controls:ButtonHelper.PreserveTextCase"
21+
Value="True" />
22+
</Style>
23+
24+
<Style x:Key="AccentedDialogHighlightedSquareButton"
25+
BasedOn="{StaticResource HighlightedSquareButtonStyle}"
26+
TargetType="{x:Type Button}">
27+
<Setter Property="controls:ButtonHelper.PreserveTextCase"
2128
Value="True" />
2229
</Style>
2330

0 commit comments

Comments
 (0)