Merge pull request #2955 from ludovic-henry/mono_msec_ticks-overflow
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Model / AttachedPropertyInfo.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.Activities.Presentation.Model
6 {
7     using System.Activities.Presentation;
8
9     public abstract class AttachedPropertyInfo
10     {
11         bool isBrowsable = true;
12         bool? isVisibleToModelItem;
13
14         public string PropertyName { get; set; }
15
16         internal bool IsBrowsable
17         {
18             get { return isBrowsable; }
19             set { this.isBrowsable = value; }
20         }
21
22         internal bool IsVisibleToModelItem
23         {
24             get { return this.isVisibleToModelItem.HasValue ? this.isVisibleToModelItem.Value : this.isBrowsable; }
25             set { this.isVisibleToModelItem = value; }
26         }
27
28         internal abstract void Register(ViewStateAttachedPropertyFeature viewStateAttachedPropertyFeature);
29     }
30
31     public sealed class AttachedPropertyInfo<T> : AttachedPropertyInfo
32     {
33         public T DefaultValue { get; set; }
34
35         internal override void Register(ViewStateAttachedPropertyFeature viewStateAttachedPropertyFeature)
36         {
37             viewStateAttachedPropertyFeature.RegisterAttachedProperty<T>(this.PropertyName, this.IsBrowsable, this.IsVisibleToModelItem, this.DefaultValue);
38         }
39     }
40 }