[amd64/tramp] hide interpreter specific trampoline behind ifdef
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / View / FilterableData.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.Activities.Presentation.View
6 {
7     using System.Windows;
8     using System.Globalization;
9     using System.Runtime;
10
11     class FilterableData : DependencyObject
12     {
13         public static readonly DependencyProperty DataProperty =
14             DependencyProperty.Register("Data", typeof(object), typeof(FilterableData), new UIPropertyMetadata(null));
15
16         public static readonly DependencyProperty IsSelectedProperty =
17             DependencyProperty.Register("IsSelected", typeof(bool), typeof(FilterableData), new UIPropertyMetadata(false));
18
19         public static readonly DependencyProperty VisibilityProperty =
20             DependencyProperty.Register("Visibility", typeof(Visibility), typeof(FilterableData), new UIPropertyMetadata(Visibility.Visible));
21
22         public object Data
23         {
24             get { return (object)GetValue(DataProperty); }
25             set { SetValue(DataProperty, value); }
26         }
27
28         public bool IsSelected
29         {
30             get { return (bool)GetValue(IsSelectedProperty); }
31             set { SetValue(IsSelectedProperty, value); }
32         }
33
34         public Visibility Visibility
35         {
36             get { return (Visibility)GetValue(VisibilityProperty); }
37             set { SetValue(VisibilityProperty, value); }
38         }
39
40         internal object Owner
41         {
42             get;
43             set;
44         }
45
46         public override string ToString()
47         {
48             return null == this.Data ? "<null>" : this.Data.ToString();
49         }
50     }
51
52     class FilterableData<TData> : FilterableData
53     {
54         [Fx.Tag.KnownXamlExternal]
55         public TData TypedData
56         {
57             get { return (TData)base.Data; }
58             set { base.Data = value; }
59         }
60
61         public override string ToString()
62         {
63             return string.Format(CultureInfo.CurrentUICulture, "{0}:({1})", base.ToString(), typeof(TData).Name);
64         }
65     }
66 }