diff options
author | Paul DiPietro <pauldipietro@users.noreply.github.com> | 2017-01-31 06:57:43 -0600 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:16:43 +0900 |
commit | eeecdc2c9a5cec0aeb849cccf75ba7490b3f4673 (patch) | |
tree | ef39d6e4aa26b69904b840079aa19e601de938e5 /Xamarin.Forms.Controls.Issues | |
parent | 77a26fc6c17ccc6d17521c45b15329c41baf9d9b (diff) | |
download | xamarin-forms-eeecdc2c9a5cec0aeb849cccf75ba7490b3f4673.tar.gz xamarin-forms-eeecdc2c9a5cec0aeb849cccf75ba7490b3f4673.tar.bz2 xamarin-forms-eeecdc2c9a5cec0aeb849cccf75ba7490b3f4673.zip |
[WinRT/UWP] Fix Slider binding value incorrectly (#729)
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
2 files changed, 63 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs new file mode 100644 index 00000000..24c277de --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41619.cs @@ -0,0 +1,62 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 41619, "[WinRT/UWP] Slider binding works incorrectly", PlatformAffected.WinRT)] + public class Bugzilla41619 : TestContentPage + { + protected override void Init() + { + var vm = new Bugzilla41619ViewModel { SliderValue = 5 }; + 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 5." } + } + }; + } + + class Bugzilla41619ViewModel : INotifyPropertyChanged + { + private double _sliderValue; + + 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)); + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 5574bbc2..b8e45b44 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -127,6 +127,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41415.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41418.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41424.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41619.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42069.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42069_Page.xaml.cs"> <DependentUpon>Bugzilla42069_Page.xaml</DependentUpon> |