summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Pages/DataItem.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-04-24 12:25:26 -0400
committerRui Marinho <me@ruimarinho.net>2016-04-24 12:25:26 -0400
commit5907152c50ee2c658b266f2804e6b383bb15a6f1 (patch)
tree9beb907623359723456c5c03b08922bebc4f41f3 /Xamarin.Forms.Pages/DataItem.cs
parentfeac1ba3ed6df5e27b3fa2076bd15c190cbacd1c (diff)
downloadxamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.gz
xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.bz2
xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.zip
Evolve feature branch (#117)
* Initial import of evolve features * [Android] Add Xamarin.Forms.Platform.Android.AppLinks project * [iOS] Fix issues with c# 6 features on iOS AppLinks * Added naive stanza to update-docs-windows.bat to produce Pages docs. Not tested. (#69) * Update packages * Add AppLinks android nuspec and fix linker issues * Fix build * Fix nusepc * Fix nuspec * Update android support nugets to 23.2.1 * Update Xamarin.UITest * Add CardView * [iOS] Fix app link for CoreSpotlight * [Android] Update AppLinks android support libs * Add Newtonsoft.Json dependency to nuspec * Fix NRE when setting ControlTemplate to null * Move to ModernHttpClient for download * Try fix build * Preserve android app links * Fix margin issue * General coding and simple fixes
Diffstat (limited to 'Xamarin.Forms.Pages/DataItem.cs')
-rw-r--r--Xamarin.Forms.Pages/DataItem.cs86
1 files changed, 86 insertions, 0 deletions
diff --git a/Xamarin.Forms.Pages/DataItem.cs b/Xamarin.Forms.Pages/DataItem.cs
new file mode 100644
index 00000000..62af919c
--- /dev/null
+++ b/Xamarin.Forms.Pages/DataItem.cs
@@ -0,0 +1,86 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Xamarin.Forms.Pages
+{
+ public class DataItem : IDataItem, INotifyPropertyChanged
+ {
+ string _name;
+ object _val;
+
+ public DataItem()
+ {
+ }
+
+ public DataItem(string name, object value)
+ {
+ _name = name;
+ _val = value;
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ set
+ {
+ if (_name == value)
+ return;
+ _name = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public object Value
+ {
+ get { return _val; }
+ set
+ {
+ if (_val == value)
+ return;
+ _val = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ return false;
+ if (ReferenceEquals(this, obj))
+ return true;
+ if (obj.GetType() != GetType())
+ return false;
+ return Equals((DataItem)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ return ((_name?.GetHashCode() ?? 0) * 397) ^ (_val?.GetHashCode() ?? 0);
+ }
+ }
+
+ public static bool operator ==(DataItem left, DataItem right)
+ {
+ return Equals(left, right);
+ }
+
+ public static bool operator !=(DataItem left, DataItem right)
+ {
+ return !Equals(left, right);
+ }
+
+ protected bool Equals(DataItem other)
+ {
+ return string.Equals(_name, other._name) && Equals(_val, other._val);
+ }
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+} \ No newline at end of file