Skip to content

Commit 3e3ecab

Browse files
authored
Backport-4.33- enable three state attribute in checkbox (#3912)
* enable three state attribute in checkbox
1 parent b6b3f13 commit 3e3ecab

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/ServiceControl.Config/UI/InstanceAdd/ServiceControlAddView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
Foreground="{StaticResource ErrorBrush}"
7979
Text="Must select either an audit or an error instance." />
8080

81-
<CheckBox Padding="0, -10, 0, 0" IsChecked="{Binding InstallErrorInstance}">
81+
<CheckBox IsThreeState="True" Padding="0, -10, 0, 0" IsChecked="{Binding InstallErrorInstance}" KeyDown ="CheckBoxError_Indeterminate" Checked="CheckBoxError_Indeterminate">
8282
<StackPanel>
8383
<Expander Header="ServiceControl" IsExpanded="{Binding IsServiceControlExpanded}" Margin="0,5,0,5">
8484
<StackPanel Margin="60,0,60,0">
@@ -240,7 +240,7 @@
240240
</StackPanel>
241241
</CheckBox>
242242

243-
<CheckBox Padding="0, -10, 0, 0" IsChecked="{Binding InstallAuditInstance}">
243+
<CheckBox IsThreeState="True" Padding="0, -10, 0, 0" IsChecked="{Binding InstallAuditInstance}" KeyDown ="CheckBoxAudit_Indeterminate" Checked="CheckBoxAudit_Indeterminate">
244244
<Expander Header="ServiceControl Audit" IsExpanded="{Binding IsServiceControlAuditExpanded}" Margin="0,5,0,5">
245245
<StackPanel Margin="60,0,60,0">
246246
<Border Margin="0,40,0,20"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
namespace ServiceControl.Config.UI.InstanceAdd
22
{
3+
using System.Windows;
4+
using System.Windows.Controls;
5+
36
public partial class ServiceControlAddView
47
{
58
public ServiceControlAddView()
69
{
710
InitializeComponent();
811
}
12+
public void CheckBoxError_Indeterminate(object sender, RoutedEventArgs e)
13+
{
14+
CheckBox_Indeterminate(sender, e);
15+
}
16+
public void CheckBoxAudit_Indeterminate(object sender, RoutedEventArgs e)
17+
{
18+
CheckBox_Indeterminate(sender, e);
19+
}
20+
public void CheckBox_Indeterminate(object sender, RoutedEventArgs e)
21+
{
22+
var chk = sender as CheckBox;
23+
chk.Indeterminate += (sender, e) => chk.IsChecked = false;
24+
}
925
}
1026
}

0 commit comments

Comments
 (0)