Skip to content

Commit 3240174

Browse files
Add TextBox.IsReadOnly option to "fields line up" demo pages
1 parent 17d5e27 commit 3240174

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/MainDemo.Wpf/FieldsLineUp.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<CheckBox x:Name="IsEnabledCheckBox"
109109
Content="IsEnabled"
110110
IsChecked="True" />
111+
<CheckBox x:Name="IsReadOnlyCheckBox" Content="TextBox.IsReadOnly" />
111112
<CheckBox x:Name="HasClearButtonCheckBox" Content="TextFieldAssist.HasClearButton" />
112113
<CheckBox x:Name="IsEditableCheckBox" Content="ComboBox.IsEditable" />
113114
</StackPanel>

src/MainDemo.Wpf/FieldsLineUp.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public FieldsLineUp()
5252
control.Margin = new Thickness(2, 10, 2, 10);
5353
if (control is ComboBox comboBox)
5454
comboBox.SetBinding(ComboBox.IsEditableProperty, new Binding(nameof(CheckBox.IsChecked)) { ElementName = nameof(IsEditableCheckBox) });
55+
if (control is TextBoxBase tb)
56+
tb.SetBinding(TextBoxBase.IsReadOnlyProperty, new Binding(nameof(CheckBox.IsChecked)) { ElementName = nameof(IsReadOnlyCheckBox) });
5557
SetValue(control);
5658
}
5759
}

src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<CheckBox x:Name="IsEnabledCheckBox"
9898
Content="IsEnabled"
9999
IsChecked="True" />
100+
<CheckBox x:Name="IsReadOnlyCheckBox" Content="TextBox.IsReadOnly" />
100101
<CheckBox x:Name="HasClearButtonCheckBox" Content="TextFieldAssist.HasClearButton" />
101102
<CheckBox x:Name="IsEditableCheckBox" Content="ComboBox.IsEditable" />
102103
</StackPanel>

src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public FieldsLineUp()
5252
control.Margin = new Thickness(2, 10, 2, 10);
5353
if (control is ComboBox comboBox)
5454
comboBox.SetBinding(ComboBox.IsEditableProperty, new Binding(nameof(CheckBox.IsChecked)) { ElementName = nameof(IsEditableCheckBox) });
55+
if (control is TextBoxBase tb)
56+
tb.SetBinding(TextBoxBase.IsReadOnlyProperty, new Binding(nameof(CheckBox.IsChecked)) { ElementName = nameof(IsReadOnlyCheckBox) });
5557
SetValue(control);
5658
}
5759
}

0 commit comments

Comments
 (0)