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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
1 deletions
-
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(), |
|
|
|
|