[corlib] Update ValueTuple implementation
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / Microsoft.Tools.Common / Microsoft / Activities / Presentation / Xaml / AttributeXamlType.cs
1 // <copyright>
2 //   Copyright (c) Microsoft Corporation.  All rights reserved.
3 // </copyright>
4
5 namespace Microsoft.Activities.Presentation.Xaml
6 {
7     using System;
8     using System.ComponentModel;
9     using System.Xaml;
10     using System.Xaml.Schema;
11
12     internal class AttributeXamlType<TAttribute, TAttributeInfo> : XamlType
13         where TAttribute : Attribute
14         where TAttributeInfo : AttributeInfo<TAttribute>, new()
15     {
16         private TAttributeInfo attributeInfo = new TAttributeInfo();
17
18         public AttributeXamlType(XamlSchemaContext xamlSchemaContext)
19             : base(typeof(TAttribute), xamlSchemaContext)
20         {
21         }
22
23         protected override XamlValueConverter<TypeConverter> LookupTypeConverter()
24         {
25             return new XamlValueConverter<TypeConverter>(typeof(AttributeConverter<TAttribute, TAttributeInfo>), this);
26         }
27
28         protected override bool LookupConstructionRequiresArguments()
29         {
30             return this.attributeInfo.LookupConstructionRequiresArguments;
31         }
32
33         protected override XamlTypeInvoker LookupInvoker()
34         {
35             if (this.attributeInfo.Invoker != null)
36             {
37                 return this.attributeInfo.Invoker;
38             }
39             else
40             {
41                 return base.LookupInvoker();
42             }
43         }
44     }
45 }