IResourceNode.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using Avalonia.Metadata;
  3. namespace Avalonia.Controls
  4. {
  5. /// <summary>
  6. /// Represents an object that can be queried for resources.
  7. /// </summary>
  8. /// <remarks>
  9. /// The interface represents a common interface for both controls that host resources
  10. /// (<see cref="IResourceHost"/>) and resource providers such as <see cref="ResourceDictionary"/>
  11. /// (see <see cref="IResourceProvider"/>).
  12. /// </remarks>
  13. [NotClientImplementable]
  14. public interface IResourceNode
  15. {
  16. /// <summary>
  17. /// Gets a value indicating whether the object has resources.
  18. /// </summary>
  19. bool HasResources { get; }
  20. /// <summary>
  21. /// Tries to find a resource within the object.
  22. /// </summary>
  23. /// <param name="key">The resource key.</param>
  24. /// <param name="value">
  25. /// When this method returns, contains the value associated with the specified key,
  26. /// if the key is found; otherwise, null.
  27. /// </param>
  28. /// <returns>
  29. /// True if the resource if found, otherwise false.
  30. /// </returns>
  31. bool TryGetResource(object key, out object? value);
  32. }
  33. }