-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Bugzilla41619.cs
80 lines (70 loc) · 1.77 KB
/
Bugzilla41619.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
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.ComponentModel;
using System.Runtime.CompilerServices;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 41619, "[WinRT/UWP] Slider binding works incorrectly", PlatformAffected.WinRT)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Slider)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
public class Bugzilla41619 : TestContentPage
{
const double _success = 6;
protected override void Init()
{
var vm = new Bugzilla41619ViewModel();
BindingContext = vm;
var label = new Label();
label.SetBinding(Label.TextProperty, "SliderValue");
var slider = new Slider
{
Maximum = 10,
Minimum = 1,
};
slider.SetBinding(Slider.ValueProperty, "SliderValue", BindingMode.TwoWay);
Content = new StackLayout
{
Children =
{
label,
slider,
new Label { Text = $"The initial slider value above should be {_success}." }
}
};
}
[Preserve(AllMembers = true)]
class Bugzilla41619ViewModel : INotifyPropertyChanged
{
private double _sliderValue = _success;
public double SliderValue
{
get { return _sliderValue; }
set
{
_sliderValue = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
#if UITEST
[Test]
public void SliderBinding()
{
RunningApp.WaitForElement(_success.ToString());
}
#endif
}
}