VisualTreeAttachmentEventArgs.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using Avalonia.Rendering;
  5. using Avalonia.VisualTree;
  6. namespace Avalonia
  7. {
  8. /// <summary>
  9. /// Holds the event arguments for the <see cref="Visual.AttachedToVisualTree"/> and
  10. /// <see cref="Visual.DetachedFromVisualTree"/> events.
  11. /// </summary>
  12. public class VisualTreeAttachmentEventArgs : EventArgs
  13. {
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="VisualTreeAttachmentEventArgs"/> class.
  16. /// </summary>
  17. /// <param name="parent">The parent that the visual is being attached to or detached from.</param>
  18. /// <param name="root">The root visual.</param>
  19. public VisualTreeAttachmentEventArgs(IVisual parent, IRenderRoot root)
  20. {
  21. Contract.Requires<ArgumentNullException>(parent != null);
  22. Contract.Requires<ArgumentNullException>(root != null);
  23. Parent = parent;
  24. Root = root;
  25. }
  26. /// <summary>
  27. /// Gets the parent that the visual is being attached to or detached from.
  28. /// </summary>
  29. public IVisual Parent { get; }
  30. /// <summary>
  31. /// Gets the root of the visual tree that the visual is being attached to or detached from.
  32. /// </summary>
  33. public IRenderRoot Root { get; }
  34. }
  35. }