This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathBugzilla23942.xaml.cs
114 lines (104 loc) · 2.33 KB
/
Bugzilla23942.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using Xamarin.Forms;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 23942, "Cannot bind properties in BindableObjects added to static resources in XAML", PlatformAffected.All)]
public partial class Bugzilla23942 : TestContentPage
{
[Preserve(AllMembers = true)]
public class TestViewModel : ViewModelBase
{
string _doesItWork;
public string DoesItWork
{
get
{
return _doesItWork;
}
set
{
_doesItWork = value;
OnPropertyChanged();
}
}
}
#if APP
public Bugzilla23942()
{
InitializeComponent();
}
#endif
private void InitializeView()
{
TestViewModel vm = new TestViewModel() { DoesItWork = "initial binding works" };
BindingContext = vm;
vm.DoesItWork = "success";
}
protected override void Init()
{
InitializeView();
}
protected override void OnAppearing()
{
base.OnAppearing();
var lbl = this.FindByName<Bugzilla23942Label>("label");
lbl.Text = lbl.Options.Text;
}
#if UITEST
[Test]
public void Bugzilla23942Test()
{
RunningApp.WaitForElement(q => q.Marked("success"));
}
#endif
}
[Preserve(AllMembers = true)]
public class Bugzilla23942Options : BindableObject
{
public static readonly BindableProperty TextProperty =
BindableProperty.Create(propertyName: nameof(Text),
returnType: typeof(string),
declaringType: typeof(Bugzilla23942Options),
defaultValue: default(string));
public string Text
{
get
{
return (string)GetValue(TextProperty);
}
set
{
SetValue(TextProperty, value);
}
}
}
[Preserve(AllMembers = true)]
public class Bugzilla23942Label : Label
{
public static readonly BindableProperty OptionsProperty =
BindableProperty.Create(propertyName: nameof(Options),
returnType: typeof(Bugzilla23942Options),
declaringType: typeof(Bugzilla23942Label),
defaultValue: default(Bugzilla23942Options));
public Bugzilla23942Options Options
{
get
{
return (Bugzilla23942Options)GetValue(OptionsProperty);
}
set
{
SetValue(OptionsProperty, value);
}
}
}
}