Add documentation for ContextPopup 21/120521/2
authorSidharth Gupta <sid92.gupta@samsung.com>
Thu, 23 Mar 2017 06:51:07 +0000 (15:51 +0900)
committerSidharth Gupta <sid92.gupta@samsung.com>
Thu, 23 Mar 2017 06:54:09 +0000 (15:54 +0900)
Signed-off-by: Sidharth Gupta <sid92.gupta@samsung.com>
Change-Id: I91221e32b25ba86ffc2b1488d954b3aca5b65bb7

Tizen.Xamarin.Forms.Extension/ContextPopup.cs
Tizen.Xamarin.Forms.Extension/ContextPopupDirection.cs
Tizen.Xamarin.Forms.Extension/ContextPopupDirectionPriorities.cs
Tizen.Xamarin.Forms.Extension/ContextPopupItem.cs
Tizen.Xamarin.Forms.Extension/ContextPopupOrientation.cs

index c4e4acc..9f17afa 100644 (file)
@@ -8,6 +8,32 @@ using Xamarin.Forms;
 
 namespace Tizen.Xamarin.Forms.Extension
 {
+    /// <summary>
+    /// The ContextPopup class allows a contextual popup to be anchored at a View.
+    /// </summary>
+    /// <example>
+    /// <code>
+    /// ContextPopup popup = new ContextPopup();
+    /// popup.Items.Add(new ContextPopupItem("Text only item"));
+    /// popup.Items.Add(new ContextPopupItem("Home icon", "home"));
+    /// popup.SelectedIndexChanged += (s, e) =>
+    /// {
+    ///     var ctxPopup = s as ContextPopup;
+    ///     Debug.WriteLine("Item with index {0} selected", ctxPopup.SelectedIndex);
+    ///     Debug.WriteLine("It has label: " + (ctxPopup.SelectedItem as ContextPopupItem).Label);
+    /// };
+    ///
+    /// Button btn = new Button
+    /// {
+    ///     Text = "Toggle popup"
+    /// };
+    /// btn.Clicked += (s, e) =>
+    /// {
+    ///     popup.Show(s as Button);
+    ///     popupShowing = true;
+    /// };
+    /// </code>
+    /// </example>
     public class ContextPopup : BindableObject
     {
         IContextPopup _contextPopup;
@@ -48,46 +74,77 @@ namespace Tizen.Xamarin.Forms.Extension
             SetBinding(SelectedItemProperty, new Binding(nameof(SelectedItem), mode: BindingMode.TwoWay, source: _contextPopup));
         }
 
+        /// <summary>
+        /// Occurs when the ContextPopup is dismissed.
+        /// </summary>
         public event EventHandler Dismissed;
 
+        /// <summary>
+        /// Occurs when an item is selected.
+        /// </summary>
         public event EventHandler SelectedIndexChanged;
 
+        /// <summary>
+        /// Gets or sets the orientation of the ContextPopup.
+        /// The default value is ContextPopupOrientation.Vertical.
+        /// </summary>
         public ContextPopupOrientation Orientation
         {
             get { return (ContextPopupOrientation)GetValue(OrientationProperty); }
             set { SetValue(OrientationProperty, value); }
         }
 
+        /// <summary>
+        /// Gets or sets whether the ContextPopup will hide automatically when the background is selected
+        /// or parent geometry is updated.
+        /// The default value is true.
+        /// </summary>
         public bool IsAutoHidingEnabled
         {
             get { return (bool)GetValue(IsAutoHidingEnabledProperty); }
             set { SetValue(IsAutoHidingEnabledProperty, value); }
         }
 
+        /// <summary>
+        /// Gets or sets the direction priorities for the ContextPopup.
+        /// </summary>
         public ContextPopupDirectionPriorities DirectionPriorities
         {
             get { return (ContextPopupDirectionPriorities)GetValue(DirectionPrioritiesProperty); }
             set { SetValue(DirectionPrioritiesProperty, value); }
         }
 
+        /// <summary>
+        /// Gets or sets the index of the selected item of the ContextPopup.
+        /// It is -1 when no item is selected.
+        /// </summary>
         public int SelectedIndex
         {
             get { return (int)GetValue(SelectedIndexProperty); }
             set { SetValue(SelectedIndexProperty, value); }
         }
 
+        /// <summary>
+        /// Gets or sets the selected item of the ContextPopup.
+        /// </summary>
         public object SelectedItem
         {
             get { return (ContextPopupItem)GetValue(SelectedItemProperty); }
             set { SetValue(SelectedItemProperty, value); }
         }
 
+        /// <summary>
+        /// Gets or sets the source list of items for the ContextPopup.
+        /// </summary>
         public IList ItemsSource
         {
             get { return (IList)GetValue(ItemsSourceProperty); }
             set { SetValue(ItemsSourceProperty, value); }
         }
 
+        /// <summary>
+        /// Gets the list of items in the ContextPopup.
+        /// </summary>
         public IList<ContextPopupItem> Items
         {
             get
@@ -96,16 +153,29 @@ namespace Tizen.Xamarin.Forms.Extension
             }
         }
 
+        /// <summary>
+        /// Shows the ContextPopup.
+        /// </summary>
+        /// <param name="anchor">The View to which the popup should be anchored.</param>
         public void Show(View anchor)
         {
             _contextPopup.Show(anchor);
         }
 
+        /// <summary>
+        /// Dismisses the ContextPopup.
+        /// </summary>
         public void Dismiss()
         {
             _contextPopup.Dismiss();
         }
 
+        /// <summary>
+        /// Gets the direction of the ContextPopup if it is shown.
+        /// This method returns false if it is not shown and the output argument is a default value.
+        /// </summary>
+        /// <param name="direction">The direction of the ContextPopup.</param>
+        /// <returns>true if the ContextPopup is shown, false otherwise.</returns>
         public bool TryGetContextPopupDirection(out ContextPopupDirection direction)
         {
             direction = default(ContextPopupDirection);
index 275726d..3ed2408 100644 (file)
@@ -1,10 +1,28 @@
-namespace Tizen.Xamarin.Forms.Extension
+namespace Tizen.Xamarin.Forms.Extension
 {
+    /// <summary>
+    /// Enumeration for the direction of a ContextPopup.
+    /// </summary>
     public enum ContextPopupDirection
     {
+        /// <summary>
+        /// The down ContextPopup direction.
+        /// </summary>
         Down,
+
+        /// <summary>
+        /// The right ContextPopup direction.
+        /// </summary>
         Right,
+
+        /// <summary>
+        /// The left ContextPopup direction.
+        /// </summary>
         Left,
+
+        /// <summary>
+        /// The up ContextPopup direction.
+        /// </summary>
         Up,
     }
 }
\ No newline at end of file
index 72fea54..10865f2 100644 (file)
@@ -1,7 +1,17 @@
-namespace Tizen.Xamarin.Forms.Extension
+namespace Tizen.Xamarin.Forms.Extension
 {
+    /// <summary>
+    /// The direction priorities of a ContextPopup.
+    /// </summary>
     public struct ContextPopupDirectionPriorities
     {
+        /// <summary>
+        /// Creates a ContextPopupDirectionPriorities structure.
+        /// </summary>
+        /// <param name="first">The first direction priority.</param>
+        /// <param name="second">The second direction priority.</param>
+        /// <param name="third">The third direction priority.</param>
+        /// <param name="fourth">The fourth direction priority.</param>
         public ContextPopupDirectionPriorities(ContextPopupDirection first, ContextPopupDirection second, ContextPopupDirection third, ContextPopupDirection fourth)
         {
             First = first;
             Fourth = fourth;
         }
 
+        /// <summary>
+        /// Gets the first direction priority.
+        /// </summary>
         public ContextPopupDirection First { get; private set; }
+
+        /// <summary>
+        /// Gets the second direction priority.
+        /// </summary>
         public ContextPopupDirection Second { get; private set; }
+
+        /// <summary>
+        /// Gets the third direction priority.
+        /// </summary>
         public ContextPopupDirection Third { get; private set; }
+
+        /// <summary>
+        /// Gets the fourth direction priority.
+        /// </summary>
         public ContextPopupDirection Fourth { get; private set; }
     }
 }
\ No newline at end of file
index fcf11e8..a7b3714 100644 (file)
@@ -4,24 +4,43 @@ using Xamarin.Forms;
 
 namespace Tizen.Xamarin.Forms.Extension
 {
+    /// <summary>
+    /// The class for the items in a ContextPopup.
+    /// Each item can have a label and an image.
+    /// </summary>
     public class ContextPopupItem : INotifyPropertyChanged
     {
         string _label;
         FileImageSource _icon;
 
+        /// <summary>
+        /// Creates a ContextPopupItem with only a label.
+        /// </summary>
+        /// <param name="label">The label of the ContextPopupItem.</param>
         public ContextPopupItem(string label)
         {
             _label = label;
         }
 
+        /// <summary>
+        /// Creates a ContextPopupItem with a label and icon.
+        /// </summary>
+        /// <param name="label">The label of the ContextPopupItem.</param>
+        /// <param name="icon">The icon of the ContextPopupItem.</param>
         public ContextPopupItem(string label, FileImageSource icon)
         {
             _label = label;
             _icon = icon;
         }
 
+        /// <summary>
+        /// Occurs when the label or icon of a ContextPopupItem is changed.
+        /// </summary>
         public event PropertyChangedEventHandler PropertyChanged;
 
+        /// <summary>
+        /// Gets or sets the label of a ContextPopupItem.
+        /// </summary>
         public string Label
         {
             get
@@ -38,6 +57,9 @@ namespace Tizen.Xamarin.Forms.Extension
             }
         }
 
+        /// <summary>
+        /// Gets or sets the icon of a ContextPopupItem.
+        /// </summary>
         public FileImageSource Icon
         {
             get
index bd1c27c..7fa45bc 100644 (file)
@@ -1,8 +1,18 @@
-namespace Tizen.Xamarin.Forms.Extension
+namespace Tizen.Xamarin.Forms.Extension
 {
+    /// <summary>
+    /// The orientation of a ContextPopup.
+    /// </summary>
     public enum ContextPopupOrientation
     {
+        /// <summary>
+        /// Shows the ContextPopup items horizontally when the ContextPopup is shown.
+        /// </summary>
         Horizontal,
+
+        /// <summary>
+        /// Shows the ContextPopup items vertically when the ContextPopup is shown.
+        /// </summary>
         Vertical,
     }
 }
\ No newline at end of file