Browse Source

Move ChildrenChanged to AutomationPeer.

ui-automation-test
Steven Kirk 4 years ago
parent
commit
f4f478c910
  1. 13
      src/Avalonia.Controls/Automation/Peers/AutomationPeer.cs
  2. 4
      src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs

13
src/Avalonia.Controls/Automation/Peers/AutomationPeer.cs

@ -167,8 +167,21 @@ namespace Avalonia.Automation.Peers
/// <returns>The provider, or null if not implemented on this peer.</returns>
public T? GetProvider<T>() => (T?)GetProviderCore(typeof(T));
/// <summary>
/// Occurs when the children of the automation peer have changed.
/// </summary>
public event EventHandler? ChildrenChanged;
/// <summary>
/// Occurs when a property value of the automation peer has changed.
/// </summary>
public event EventHandler<AutomationPropertyChangedEventArgs>? PropertyChanged;
/// <summary>
/// Raises an event to notify the automation client the the children of the peer have changed.
/// </summary>
protected void RaiseChildrenChangedEvent() => ChildrenChanged?.Invoke(this, EventArgs.Empty);
/// <summary>
/// Raises an event to notify the automation client of a changed property value.
/// </summary>

4
src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs

@ -26,8 +26,6 @@ namespace Avalonia.Automation.Peers
public Control Owner { get; }
public event EventHandler? ChildrenChanged;
public AutomationPeer GetOrCreate(Control element)
{
if (element == Owner)
@ -110,7 +108,7 @@ namespace Avalonia.Automation.Peers
protected void InvalidateChildren()
{
_childrenValid = false;
ChildrenChanged?.Invoke(this, EventArgs.Empty);
RaiseChildrenChangedEvent();
}
/// <summary>

Loading…
Cancel
Save