diff --git a/src/Avalonia.Base/StyledPropertyBase.cs b/src/Avalonia.Base/StyledPropertyBase.cs
index 16ba571a5a..535a826c1e 100644
--- a/src/Avalonia.Base/StyledPropertyBase.cs
+++ b/src/Avalonia.Base/StyledPropertyBase.cs
@@ -159,9 +159,9 @@ namespace Avalonia
}
///
- public override void Accept(IAvaloniaPropertyVisitor vistor, ref TData data)
+ public override void Accept(IAvaloniaPropertyVisitor visitor, ref TData data)
{
- vistor.Visit(this, ref data);
+ visitor.Visit(this, ref data);
}
///
@@ -242,11 +242,5 @@ namespace Avalonia
_ = type ?? throw new ArgumentNullException(nameof(type));
return GetMetadata(type).DefaultValue;
}
-
- [DebuggerHidden]
- private Func Cast(Func validate)
- {
- return (o, v) => validate((THost)o, v);
- }
}
}
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/BindingSetterViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/BindingSetterViewModel.cs
index de3e56e514..16973a96ef 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/BindingSetterViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/BindingSetterViewModel.cs
@@ -14,11 +14,13 @@ namespace Avalonia.Diagnostics.ViewModels
case Binding binding:
Path = binding.Path;
Tint = Brushes.CornflowerBlue;
+ ValueTypeTooltip = "Reflection Binding";
break;
case CompiledBindingExtension binding:
Path = binding.Path.ToString();
Tint = Brushes.DarkGreen;
+ ValueTypeTooltip = "Compiled Binding";
break;
case TemplateBinding binding:
@@ -32,6 +34,7 @@ namespace Avalonia.Diagnostics.ViewModels
}
Tint = Brushes.OrangeRed;
+ ValueTypeTooltip = "Template Binding";
break;
default:
@@ -40,6 +43,8 @@ namespace Avalonia.Diagnostics.ViewModels
}
public IBrush Tint { get; }
+
+ public string ValueTypeTooltip { get; }
public string Path { get; }
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
index 701947d2ab..a1fd8ed028 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
@@ -155,31 +155,19 @@ namespace Avalonia.Diagnostics.ViewModels
public object? SelectedEntity
{
get => _selectedEntity;
- set
- {
- RaiseAndSetIfChanged(ref _selectedEntity, value);
-
- }
+ set => RaiseAndSetIfChanged(ref _selectedEntity, value);
}
public string? SelectedEntityName
{
get => _selectedEntityName;
- set
- {
- RaiseAndSetIfChanged(ref _selectedEntityName, value);
-
- }
+ set => RaiseAndSetIfChanged(ref _selectedEntityName, value);
}
public string? SelectedEntityType
{
get => _selectedEntityType;
- set
- {
- RaiseAndSetIfChanged(ref _selectedEntityType, value);
-
- }
+ set => RaiseAndSetIfChanged(ref _selectedEntityType, value);
}
public PropertyViewModel? SelectedProperty
@@ -502,6 +490,31 @@ namespace Avalonia.Diagnostics.ViewModels
inpc2.PropertyChanged += ControlPropertyChanged;
}
}
+
+ internal void SelectProperty(AvaloniaProperty property)
+ {
+ SelectedProperty = null;
+
+ if (SelectedEntity != _avaloniaObject)
+ {
+ NavigateToProperty(_avaloniaObject, (_avaloniaObject as IControl)?.Name ?? _avaloniaObject.ToString());
+ }
+
+ if (PropertiesView is null)
+ {
+ return;
+ }
+
+ foreach (object o in PropertiesView)
+ {
+ if (o is AvaloniaPropertyViewModel propertyVm && propertyVm.Property == property)
+ {
+ SelectedProperty = propertyVm;
+
+ break;
+ }
+ }
+ }
internal void UpdatePropertiesView(bool showImplementedInterfaces)
{
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ResourceSetterViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ResourceSetterViewModel.cs
index e93dc7361b..5202ac963e 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ResourceSetterViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ResourceSetterViewModel.cs
@@ -7,11 +7,14 @@ namespace Avalonia.Diagnostics.ViewModels
public object Key { get; }
public IBrush Tint { get; }
+
+ public string ValueTypeTooltip { get; }
public ResourceSetterViewModel(AvaloniaProperty property, object resourceKey, object? resourceValue, bool isDynamic) : base(property, resourceValue)
{
Key = resourceKey;
Tint = isDynamic ? Brushes.Orange : Brushes.Brown;
+ ValueTypeTooltip = isDynamic ? "Dynamic Resource" : "Static Resource";
}
public void CopyResourceKey()
diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml
index ec97b213a9..cc392853be 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml
+++ b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml
@@ -44,7 +44,9 @@
UseWholeWordFilter="{Binding UseWholeWordFilter}"
UseRegexFilter="{Binding UseRegexFilter}"/>
-
+
+
+
+
+
+
+
+
+
+
@@ -138,6 +160,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -147,28 +180,17 @@
-
+
{
-
+
}
-
+
-
-
-
-
-
-
-
-
-
-
-
@@ -179,15 +201,15 @@
-
+
(
-
+
)
-
+
@@ -200,11 +222,11 @@
-
+
-
+
diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml.cs b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml.cs
index 78919a2105..08ffe2c081 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml.cs
@@ -7,9 +7,13 @@ namespace Avalonia.Diagnostics.Views
{
internal class ControlDetailsView : UserControl
{
+ private DataGrid _dataGrid;
+
public ControlDetailsView()
{
InitializeComponent();
+
+ _dataGrid = this.GetControl("DataGrid");
}
private void InitializeComponent()
@@ -25,5 +29,25 @@ namespace Avalonia.Diagnostics.Views
}
}
+
+ private void PropertyNamePressed(object sender, PointerPressedEventArgs e)
+ {
+ var mainVm = (ControlDetailsViewModel?) DataContext;
+
+ if (mainVm is null)
+ {
+ return;
+ }
+
+ if (sender is Control control && control.DataContext is SetterViewModel setterVm)
+ {
+ mainVm.SelectProperty(setterVm.Property);
+
+ if (mainVm.SelectedProperty is not null)
+ {
+ _dataGrid.ScrollIntoView(mainVm.SelectedProperty, null);
+ }
+ }
+ }
}
}