diff --git a/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs b/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs
index 33166f1147..46ee8e686c 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs
@@ -30,6 +30,11 @@ namespace Avalonia.Diagnostics
///
public int? StartupScreenIndex { get; set; }
+ ///
+ /// Gets or sets a value indicating whether DevTools should be displayed implemented interfaces on Control details. The default value is true.
+ ///
+ public bool ShowImplementedInterfaces { get; set; } = true;
+
///
/// Allow to customizze SreenshotHandler
///
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
index 2617091a79..8f0a4d07b0 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
@@ -27,6 +27,7 @@ namespace Avalonia.Diagnostics.ViewModels
private readonly Stack<(string Name,object Entry)> _selectedEntitiesStack = new();
private string? _selectedEntityName;
private string? _selectedEntityType;
+ private bool _showImplementedInterfaces;
public ControlDetailsViewModel(TreePageViewModel treePage, IAvaloniaObject avaloniaObject)
{
@@ -246,18 +247,21 @@ namespace Avalonia.Diagnostics.ViewModels
}
}
- private IEnumerable GetClrProperties(object o)
+ private IEnumerable GetClrProperties(object o, bool showImplementedInterfaces)
{
foreach (var p in GetClrProperties(o, o.GetType()))
{
yield return p;
}
- foreach (var i in o.GetType().GetInterfaces())
+ if (showImplementedInterfaces)
{
- foreach (var p in GetClrProperties(o, i))
+ foreach (var i in o.GetType().GetInterfaces())
{
- yield return p;
+ foreach (var p in GetClrProperties(o, i))
+ {
+ yield return p;
+ }
}
}
}
@@ -454,7 +458,7 @@ namespace Avalonia.Diagnostics.ViewModels
SelectedEntityName = entityName;
SelectedEntityType = o.ToString();
var properties = GetAvaloniaProperties(o)
- .Concat(GetClrProperties(o))
+ .Concat(GetClrProperties(o, _showImplementedInterfaces))
.OrderBy(x => x, PropertyComparer.Instance)
.ThenBy(x => x.Name)
.ToList();
@@ -475,5 +479,12 @@ namespace Avalonia.Diagnostics.ViewModels
inpc2.PropertyChanged += ControlPropertyChanged;
}
}
+
+ internal void UpdatePropertiesView(bool showImplementedInterfaces)
+ {
+ _showImplementedInterfaces = showImplementedInterfaces;
+ SelectedProperty = null;
+ NavigateToProperty(_avaloniaObject, (_avaloniaObject as IControl)?.Name ?? _avaloniaObject.ToString());
+ }
}
}
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs
index c96ddf129e..e08c5bc8dd 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs
@@ -31,6 +31,7 @@ namespace Avalonia.Diagnostics.ViewModels
private IInputRoot? _pointerOverRoot;
private IScreenshotHandler? _screenshotHandler;
private bool _showPropertyType;
+ private bool _showImplementedInterfaces;
public MainViewModel(AvaloniaObject root)
{
@@ -323,6 +324,22 @@ namespace Avalonia.Diagnostics.ViewModels
{
_screenshotHandler = options.ScreenshotHandler;
StartupScreenIndex = options.StartupScreenIndex;
+ ShowImplementedInterfaces = options.ShowImplementedInterfaces;
+ }
+
+ public bool ShowImplementedInterfaces
+ {
+ get => _showImplementedInterfaces;
+ private set => RaiseAndSetIfChanged(ref _showImplementedInterfaces , value);
+ }
+
+ public void ToggleShowImplementedInterfaces(object parametr)
+ {
+ ShowImplementedInterfaces = !ShowImplementedInterfaces;
+ if (Content is TreePageViewModel viewModel)
+ {
+ viewModel.UpdatePropertiesView();
+ }
}
public bool ShowDettailsPropertyType
diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreePageViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreePageViewModel.cs
index 4416437479..0cb2e388f7 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreePageViewModel.cs
+++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreePageViewModel.cs
@@ -39,6 +39,7 @@ namespace Avalonia.Diagnostics.ViewModels
Details = value != null ?
new ControlDetailsViewModel(this, value.Visual) :
null;
+ Details?.UpdatePropertiesView(MainView.ShowImplementedInterfaces);
Details?.UpdateStyleFilters();
}
}
@@ -135,5 +136,10 @@ namespace Avalonia.Diagnostics.ViewModels
return null;
}
+
+ internal void UpdatePropertiesView()
+ {
+ Details?.UpdatePropertiesView(MainView?.ShowImplementedInterfaces ?? true);
+ }
}
}
diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml
index 91c8eb0983..35c9e27f1a 100644
--- a/src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml
+++ b/src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml
@@ -45,7 +45,14 @@
IsEnabled="False" />
-
+