WPF TextBox: How to change binding mode default to OneWay?
问题 Initially, I have the following code: <TextBox Text="{Binding LengthUnit, Mode=OneWay}" IsReadOnly="True" Background="{x:Static SystemColors.ControlBrush}" /> I know I can define a style like this: <Style TargetType="{x:Type TextBox}" x:Key="readOnlyTextBox"> <Setter Property="Background" Value="{x:Static SystemColors.ControlBrush}"></Setter> <Setter Property="IsReadOnly" Value="True"></Setter> </Style> So that I can write: <TextBox Text="{Binding LengthUnit, Mode=OneWay}" Style="