Browse Source

Revert "Try to fix problem with ComboBox."

This reverts commit c34a825bf5.
ui-automation-test
Steven Kirk 5 years ago
parent
commit
acb49d66e9
  1. 11
      src/Avalonia.Controls/Automation/Peers/PopupAutomationPeer.cs
  2. 6
      src/Avalonia.Controls/Control.cs

11
src/Avalonia.Controls/Automation/Peers/PopupAutomationPeer.cs

@ -2,7 +2,6 @@
using System.Collections.Generic;
using Avalonia.Automation.Platform;
using Avalonia.Controls;
using Avalonia.Controls.Diagnostics;
using Avalonia.Controls.Primitives;
using Avalonia.VisualTree;
@ -21,9 +20,9 @@ namespace Avalonia.Automation.Peers
protected override IReadOnlyList<AutomationPeer>? GetChildrenCore()
{
var popupHost = ((IPopupHostProvider)Owner)?.PopupHost as Control;
var hostPeer = popupHost?.GetAutomationPeer();
return hostPeer is object ? new[] { hostPeer } : null;
var host = (IVisualTreeHost)Owner;
System.Diagnostics.Debug.WriteLine($"Popup children='{host}'");
return host.Root is Control c ? new[] { GetOrCreatePeer(c) } : null;
}
protected override bool IsContentElementCore() => false;
@ -46,8 +45,8 @@ namespace Avalonia.Automation.Peers
private AutomationPeer? GetPopupRoot()
{
var popupRoot = ((IPopupHostProvider)Owner).PopupHost as Control;
return popupRoot?.GetAutomationPeer();
var popupRoot = ((IVisualTreeHost)Owner).Root as Control;
return popupRoot is object ? GetOrCreatePeer(popupRoot) : null;
}
}
}

6
src/Avalonia.Controls/Control.cs

@ -235,12 +235,6 @@ namespace Avalonia.Controls
return new NoneAutomationPeer(factory, this);
}
internal AutomationPeer? GetAutomationPeer()
{
VerifyAccess();
return _automationPeer;
}
internal AutomationPeer GetOrCreateAutomationPeer(IAutomationNodeFactory factory)
{
VerifyAccess();

Loading…
Cancel
Save