Styles.cs 909 B

12345678910111213141516171819202122232425262728
  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. using Perspex.Collections;
  4. namespace Perspex.Styling
  5. {
  6. /// <summary>
  7. /// A style that consists of a number of child styles.
  8. /// </summary>
  9. public class Styles : PerspexList<IStyle>, IStyle
  10. {
  11. /// <summary>
  12. /// Attaches the style to a control if the style's selector matches.
  13. /// </summary>
  14. /// <param name="control">The control to attach to.</param>
  15. /// <param name="container">
  16. /// The control that contains this style. May be null.
  17. /// </param>
  18. public void Attach(IStyleable control, IStyleHost container)
  19. {
  20. foreach (IStyle style in this)
  21. {
  22. style.Attach(control, container);
  23. }
  24. }
  25. }
  26. }