Fix example and remove unsupported properties in GridView 59/124659/3
authorSungHyun Min <shyun.min@samsung.com>
Wed, 12 Apr 2017 05:28:55 +0000 (14:28 +0900)
committerSungHyun Min <shyun.min@samsung.com>
Thu, 13 Apr 2017 01:38:37 +0000 (10:38 +0900)
Change-Id: I07227aff98387a8836d17d641d3ffabfedafa13d
Signed-off-by: SungHyun Min <shyun.min@samsung.com>
Tizen.Xamarin.Forms.Extension.Renderer/GridViewRenderer.cs
Tizen.Xamarin.Forms.Extension/GridView.cs

index 75870ff..a5a072f 100644 (file)
@@ -14,6 +14,7 @@ using ItemContext = Xamarin.Forms.Platform.Tizen.Native.ListView.ItemContext;
 using TForms = Xamarin.Forms.Platform.Tizen.Forms;
 
 [assembly: ExportRenderer(typeof(GridView), typeof(GridViewRenderer))]
+
 namespace Tizen.Xamarin.Forms.Extension.Renderer
 {
     class GridViewRenderer : ViewRenderer<GridView, GenGrid>, IDisposable
@@ -33,8 +34,6 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
             _scrollToRequested = OnScrollToRequested;
             _collectionChanged = OnCollectionChanged;
 
-            RegisterPropertyHandler(GridView.ColumnSpacingProperty, UpdateColumnSpacing);
-            RegisterPropertyHandler(GridView.RowSpacingProperty, UpdateRowSpacing);
             RegisterPropertyHandler(GridView.ItemHeightProperty, UpdateItemHeight);
             RegisterPropertyHandler(GridView.ItemWidthProperty, UpdateItemWidth);
             RegisterPropertyHandler(GridView.SelectionModeProperty, UpdateSelectionMode);
@@ -81,16 +80,6 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
             base.OnElementChanged(e);
         }
 
-        void UpdateColumnSpacing()
-        {
-            Control.WeightY = Element.ColumnSpacing;
-        }
-
-        void UpdateRowSpacing()
-        {
-            Control.WeightX = Element.RowSpacing;
-        }
-
         void UpdateItemHeight()
         {
             if (Element.ItemHeight < 0)
@@ -123,12 +112,15 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
                 case GridViewSelectionMode.Default:
                     Control.SelectionMode = GenGridSelectionMode.Default;
                     break;
+
                 case GridViewSelectionMode.Always:
                     Control.SelectionMode = GenGridSelectionMode.Always;
                     break;
+
                 case GridViewSelectionMode.DisplayOnly:
                     Control.SelectionMode = GenGridSelectionMode.DisplayOnly;
                     break;
+
                 case GridViewSelectionMode.None:
                     Control.SelectionMode = GenGridSelectionMode.None;
                     break;
@@ -343,5 +335,4 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
             }
         }
     }
-}
-
+}
\ No newline at end of file
index 2030f67..c48d7a9 100644 (file)
@@ -10,12 +10,32 @@ namespace Tizen.Xamarin.Forms.Extension
     /// </summary>
     /// <example>
     /// <code>
-    /// public class MyObject
+    ///  public class MyObject : BindableObject
     /// {
-    ///     public string Text { get; set; }
-    ///     public string ImagePath { get; set; }
-    ///     public bool IsBadgeVisible { get; set; }
-    ///     public int Count { get; set; }
+    ///     public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(MyObject), "");
+    ///     public static readonly BindableProperty ImagePathProperty = BindableProperty.Create("ImagePath", typeof(string), typeof(MyObject), "");
+    ///     public static readonly BindableProperty IsBadgeVisibleProperty = BindableProperty.Create("IsBadgeVisible", typeof(bool), typeof(MyObject), false);
+    ///     public static readonly BindableProperty CountProperty = BindableProperty.Create("Count", typeof(int), typeof(MyObject), 0);
+    ///     public string Text
+    ///     {
+    ///         get { return (string)GetValue(TextProperty); }
+    ///         set { SetValue(TextProperty, value); }
+    ///     }
+    ///     public string ImagePath
+    ///     {
+    ///         get { return (string)GetValue(ImagePathProperty); }
+    ///         set { SetValue(ImagePathProperty, value); }
+    ///     }
+    ///     public bool IsBadgeVisible
+    ///     {
+    ///         get { return (bool)GetValue(IsBadgeVisibleProperty); }
+    ///         set { SetValue(IsBadgeVisibleProperty, value); }
+    ///     }
+    ///     public int Count
+    ///     {
+    ///         get { return (int)GetValue(CountProperty); }
+    ///         set { SetValue(CountProperty, value); }
+    ///     }
     /// }
     /// public class GridViewTest : ContentPage
     /// {
@@ -24,20 +44,18 @@ namespace Tizen.Xamarin.Forms.Extension
     ///         List<MyObject> MyData = new List<MyObject>();
     ///         for (int i = 0; i < 50; i++)
     ///         {
-    ///             MyData.Add(new MyObject { Text = "AAAA", ImagePath = "1.png", IsBadgeVisible = false, Count = 0);
-    ///             MyData.Add(new MyObject { Text = "BBBB", ImagePath = "1.png", IsBadgeVisible = false, Count = 0);
-    ///             MyData.Add(new MyObject { Text = "CCCC", ImagePath = "1.png", IsBadgeVisible = false, Count = 0);
-    ///             MyData.Add(new MyObject { Text = "DDDD", ImagePath = "1.png", IsBadgeVisible = false, Count = 0);
+    ///             MyData.Add(new MyObject { Text = "AAAA", ImagePath = "1.png", IsBadgeVisible = false, Count = 0 });
+    ///             MyData.Add(new MyObject { Text = "BBBB", ImagePath = "1.png", IsBadgeVisible = false, Count = 0 });
+    ///             MyData.Add(new MyObject { Text = "CCCC", ImagePath = "1.png", IsBadgeVisible = false, Count = 0 });
+    ///             MyData.Add(new MyObject { Text = "DDDD", ImagePath = "1.png", IsBadgeVisible = false, Count = 0 });
     ///         }
     ///         GridView view = new GridView
     ///         {
-    ///             ItemColumn = new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) },
-    ///             ItemRow = new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
+    ///             ItemWidth = 150,
+    ///             ItemHeight = 150,
     ///             SelectionMode = GridViewSelectionMode.Default,
     ///             CanSelectMultiple = true,
     ///             IsHighlightEffectEnabled = true,
-    ///             ColumnSpacing = 0.5,
-    ///             RowSpacing = 0.5,
     ///             ItemsSource = MyData,
     ///             ItemTemplate = new DataTemplate(() =>
     ///             {
@@ -74,10 +92,6 @@ namespace Tizen.Xamarin.Forms.Extension
         const int DefaultItemWidth = -1;
         const int DefaultItemHeight = -1;
 
-        public static readonly BindableProperty ColumnSpacingProperty = BindableProperty.Create("ColumnSpacing", typeof(double), typeof(GridView), default(double));
-
-        public static readonly BindableProperty RowSpacingProperty = BindableProperty.Create("RowSpacing", typeof(double), typeof(GridView), default(double));
-
         public static readonly BindableProperty ItemHeightProperty = BindableProperty.Create("ItemHeight", typeof(int), typeof(GridView), DefaultItemHeight);
 
         public static readonly BindableProperty ItemWidthProperty = BindableProperty.Create("ItemWidth", typeof(int), typeof(GridView), DefaultItemWidth);
@@ -171,24 +185,6 @@ namespace Tizen.Xamarin.Forms.Extension
         }
 
         /// <summary>
-        /// Gets or sets colum spacing of the GridView.
-        /// </summary>
-        public double ColumnSpacing
-        {
-            get { return (double)GetValue(ColumnSpacingProperty); }
-            set { SetValue(ColumnSpacingProperty, value); }
-        }
-
-        /// <summary>
-        /// Gets or sets row spacing of the GridView.
-        /// </summary>
-        public double RowSpacing
-        {
-            get { return (double)GetValue(RowSpacingProperty); }
-            set { SetValue(RowSpacingProperty, value); }
-        }
-
-        /// <summary>
         /// Gets or sets select mode.
         /// </summary>
         public GridViewSelectionMode SelectionMode