Browse Source

Merge pull request #10832 from AvaloniaUI/fixes/10680-devtools-readonly-properties

DEvTools: bind read-only properties one-way.
pull/10874/head
Max Katz 3 years ago
committed by GitHub
parent
commit
daa0e5c7c1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/Avalonia.Diagnostics/Diagnostics/Views/PropertyValueEditorView.cs

3
src/Avalonia.Diagnostics/Diagnostics/Views/PropertyValueEditorView.cs

@ -64,11 +64,12 @@ namespace Avalonia.Diagnostics.Views
where TControl : Control, new()
{
var control = new TControl();
var bindingMode = Property.IsReadonly ? BindingMode.OneWay : BindingMode.TwoWay;
init?.Invoke(control);
control.Bind(valueProperty,
new Binding(nameof(Property.Value), BindingMode.TwoWay)
new Binding(nameof(Property.Value), bindingMode)
{
Source = Property,
Converter = converter ?? new ValueConverter(),

Loading…
Cancel
Save