VisualBrush.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. namespace Perspex.Media
  4. {
  5. /// <summary>
  6. /// Paints an area with an <see cref="IVisual"/>.
  7. /// </summary>
  8. public class VisualBrush : TileBrush
  9. {
  10. /// <summary>
  11. /// Defines the <see cref="Visual"/> property.
  12. /// </summary>
  13. public static readonly StyledProperty<IVisual> VisualProperty =
  14. PerspexProperty.Register<VisualBrush, IVisual>("Visual");
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="VisualBrush"/> class.
  17. /// </summary>
  18. public VisualBrush()
  19. {
  20. }
  21. /// <summary>
  22. /// Initializes a new instance of the <see cref="VisualBrush"/> class.
  23. /// </summary>
  24. /// <param name="visual">The visual to draw.</param>
  25. public VisualBrush(IVisual visual)
  26. {
  27. Visual = visual;
  28. }
  29. /// <summary>
  30. /// Gets or sets the visual to draw.
  31. /// </summary>
  32. public IVisual Visual
  33. {
  34. get { return GetValue(VisualProperty); }
  35. set { SetValue(VisualProperty, value); }
  36. }
  37. }
  38. }