diff options
Diffstat (limited to 'Xamarin.Forms.Controls')
-rw-r--r-- | Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs index 2941b4bb..f0f404c7 100644 --- a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs +++ b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs @@ -52,13 +52,14 @@ namespace Xamarin.Forms.Controls var label = new Label(); label.SetBinding(Label.TextProperty, "FormsLabel"); + var labelAge = new Label(); + labelAge.SetBinding(Label.TextProperty, nameof(vm.Age)); Layout.Children.Add(buttonNav); - Layout.Children.Add(label); - Layout.Children.Add(boxView); Layout.Children.Add(button); + Layout.Children.Add(labelAge); BindingContext = ViewModel = vm; ; @@ -74,35 +75,35 @@ namespace Xamarin.Forms.Controls public string FormsLabel { get { return _formsLabel; } - set { _formsLabel = value; OnPropertyChanged(); } + set { if (_formsLabel == value) return; _formsLabel = value; OnPropertyChanged(); } } string _nativeLabel; public string NativeLabel { get { return _nativeLabel; } - set { _nativeLabel = value; OnPropertyChanged(); } + set { if (_nativeLabel == value) return; _nativeLabel = value; OnPropertyChanged(); } } Color _nativeLabelColor; public Color NativeLabelColor { get { return _nativeLabelColor; } - set { _nativeLabelColor = value; OnPropertyChanged(); } + set { if (_nativeLabelColor == value) return; _nativeLabelColor = value; OnPropertyChanged(); } } int _age; public int Age { get { return _age; } - set { _age = value; OnPropertyChanged(); } + set { if (_age == value) return; _age = value; OnPropertyChanged(); } } bool _selected; public bool Selected { get { return _selected; } - set { _selected = value; OnPropertyChanged(); } + set { if (_selected == value) return; _selected = value; OnPropertyChanged(); } } } |