/V4/MVVM RI/MVVM.Client/Infrastructure/ExportViewAttribute.cs

# · C# · 38 lines · 15 code · 1 blank · 22 comment · 0 complexity · f3d75ebb0407b0fa855c30183a9192e1 MD5 · raw file

  1. //===================================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4. //===================================================================================
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. // FITNESS FOR A PARTICULAR PURPOSE.
  10. //===================================================================================
  11. // The example companies, organizations, products, domain names,
  12. // e-mail addresses, logos, people, places, and events depicted
  13. // herein are fictitious. No association with any real company,
  14. // organization, product, domain name, email address, logo, person,
  15. // places, or events is intended or should be inferred.
  16. //===================================================================================
  17. using System;
  18. using System.ComponentModel.Composition;
  19. using System.Windows.Controls;
  20. namespace MVVM.Client.Infrastructure
  21. {
  22. /// <summary>
  23. /// MEF Metadata attribute to ensure views are registered appropriately
  24. /// </summary>
  25. /// <remarks>
  26. /// This works in conjunction with <see cref="ViewFactory"/> to locate views from the <see cref="System.ComponentModel.Composition.Hosting.CompositionContainer"/>
  27. /// </remarks>
  28. [MetadataAttribute]
  29. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
  30. public class ExportViewAttribute : ExportAttribute
  31. {
  32. public ExportViewAttribute(string viewName)
  33. : base(viewName, typeof(UserControl))
  34. {
  35. }
  36. }
  37. }