In WPF I try to use databinding to define the BindingMode.
<controls:BoolToStringConverter x:Key="BoolToStringConverter" FalseValue="OneWay" TrueValue="TwoWay" />
<TextBox Text="{Binding MyText, Mode="{Binding Path=IsWriteable, Converter={StaticResource BoolToStringConverter}}" />
also, I've tried with a System.Windows.Data.BindingMode enum as datatype of property "MyBindingMode" and bind to this, but it isn't working either
<TextBox Text="{Binding MyText, Mode={Binding Path=MyBindingMode}}" />
Is there any possibility for such a binding or what is an appropriate approach to achieve this?
Edit:
actually in my context it's not an TextBox, it is a DataGridTextColumn. I've tried to bind IsReadOnly="{Binding IsOnlyReadable}"
but that has no effect on the DataGridTextColumn. Setting it fixed to IsReadOnly=True
works but binding it to a constantly true property doesn't have this effect.
Finally it is solved and I've used this for the Binding of a DataGridColumn: https://stackoverflow.com/a/27465022/9758687