summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2016-09-30 18:48:22 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-09-30 18:48:22 (GMT)
commitfa2f01680d23a813a5b1ab7795151b6dcb0feb7f (patch)
tree74e7d0e301f237cde7a0b1ce4e95d53ebcc80a43 /Xamarin.Forms.Controls
parentc07c2314f5737d480088319e87ab299b22cb4ddc (diff)
downloadxamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.zip
xamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.tar.gz
xamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.tar.bz2
[iOS] Keep our native property listener around the same time we keep our proxy, check if we are KVO compliant before adding observer (#403)
Diffstat (limited to 'Xamarin.Forms.Controls')
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs
index 2941b4b..f0f404c 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(); }
}
}