From 087a7af028798f0341033573b962e54ef1145af8 Mon Sep 17 00:00:00 2001 From: Miepee Date: Sat, 4 Mar 2023 14:20:02 +0100 Subject: [PATCH] Revise documentation for DropDown --- src/Eto/Forms/Controls/DropDown.cs | 97 ++++++++++++------------------ 1 file changed, 40 insertions(+), 57 deletions(-) diff --git a/src/Eto/Forms/Controls/DropDown.cs b/src/Eto/Forms/Controls/DropDown.cs index e82c4735ba..9b81d4b056 100755 --- a/src/Eto/Forms/Controls/DropDown.cs +++ b/src/Eto/Forms/Controls/DropDown.cs @@ -5,14 +5,14 @@ namespace Eto.Forms; /// -/// Arguments for formatting items in a DropDown using the event. +/// Arguments for formatting items in a drop down using the event. /// public class DropDownFormatEventArgs : EventArgs { Font _font; /// - /// Gets or sets the font to use for this item + /// Gets or sets the font to use for this item. /// public virtual Font Font { @@ -33,21 +33,21 @@ public virtual Font Font public bool IsFontSet { get; private set; } /// - /// Item to specify the format for + /// Item to specify the format for. /// public object Item { get; } /// - /// Row number in the list of items to format for + /// Row number in the list of items to format for. /// public int Row { get; } /// - /// Initializes a new instance of the DropDownFormatEventArgs class + /// Initializes a new instance of the DropDownFormatEventArgs class. /// - /// Item to format - /// Row of the item to format - /// Font to use if no other is specified + /// Item to format. + /// Row of the item to format. + /// Font to use if no other is specified. public DropDownFormatEventArgs(object item, int row, Font font) { Item = item; @@ -57,8 +57,15 @@ public DropDownFormatEventArgs(object item, int row, Font font) } /// -/// Presents a drop down to select from a list of items +/// Presents a drop down to select from a list of items. /// +/// +/// Here is a short example on how to create a drop down with its items being based off a list: +/// +/// var list = new List<string>() { "First item", "Second item", "Third item" }; +/// var dropdown = new DropDown() { DataStore = list }; +/// +/// [Handler(typeof(DropDown.IHandler))] public class DropDown : ListControl { @@ -83,7 +90,7 @@ public DropDown() /// Gets or sets the binding to get the image for each item. /// /// - /// By default this looks for the "Image" property of the item, and also works if you use . + /// By default this looks for the Image property of the item, and also works if you use . /// /// This will be ignored when creating a , and is only supported with the directly. /// @@ -95,10 +102,9 @@ public DropDown() /// /// /// This is a hint to omit the border of the control and show it as plainly as possible. - /// /// Typically used when you want to show the control within a cell of the . /// - /// true to show the control border; otherwise, false. + /// to show the control border; otherwise, . [DefaultValue(true)] public bool ShowBorder { @@ -107,7 +113,7 @@ public bool ShowBorder } /// - /// Event identifier for handlers when attaching the event + /// Event identifier for handlers when attaching the event. /// public const string DropDownOpeningEvent = "DropDown.DropDownOpening"; @@ -126,7 +132,7 @@ public event EventHandler DropDownOpening /// /// Raises the event. /// - /// Event arguments + /// Event arguments. protected virtual void OnDropDownOpening(EventArgs e) { Properties.TriggerEvent(DropDownOpeningEvent, this, e); @@ -147,9 +153,9 @@ public event EventHandler DropDownClosed } /// - /// Raises the event + /// Raises the event. /// - /// Event arguments + /// Event arguments. protected virtual void OnDropDownClosed(EventArgs e) { Properties.TriggerEvent(DropDownClosedEvent, this, e); @@ -172,74 +178,59 @@ public event EventHandler FormatItem /// /// Raises the event. /// - /// Event Arguments + /// Event Arguments. protected virtual void OnFormatItem(DropDownFormatEventArgs e) => Properties.TriggerEvent(FormatItemEvent, this, e); - /// - /// Gets the callback. - /// - /// The callback. + /// protected override object GetCallback() => new Callback(); /// - /// Callback interface for the DropDown + /// Callback interface for the control. /// public new interface ICallback : ListControl.ICallback { /// - /// Raises the event. + /// /// - /// Widget to raise the event - /// Event arguments + /// Widget to raise the event. + /// Event arguments. void OnDropDownOpening(DropDown widget, EventArgs e); /// - /// Raises the event + /// /// - /// Widget to raise the event - /// Event arguments + /// Widget to raise the event. + /// Event arguments. void OnDropDownClosed(DropDown widget, EventArgs e); /// - /// Raises the event. + /// /// - /// Widget to raise the event - /// Event Arguments + /// Widget to raise the event. + /// Event Arguments. void OnFormatItem(DropDown widget, DropDownFormatEventArgs e); } /// - /// Callback implementation for the DropDown + /// Callback implementation for the control. /// protected new class Callback : ListControl.Callback, ICallback { - /// - /// Raises the event. - /// - /// Widget to raise the event - /// Event arguments + /// public void OnDropDownOpening(DropDown widget, EventArgs e) { using (widget.Platform.Context) widget.OnDropDownOpening(e); } - /// - /// Raises the event - /// - /// Widget to raise the event - /// Event arguments + /// public void OnDropDownClosed(DropDown widget, EventArgs e) { using (widget.Platform.Context) widget.OnDropDownClosed(e); } - /// - /// Raises the event. - /// - /// Widget to raise the event - /// Event Arguments + /// /// public void OnFormatItem(DropDown widget, DropDownFormatEventArgs e) { using (widget.Platform.Context) @@ -248,19 +239,11 @@ public void OnFormatItem(DropDown widget, DropDownFormatEventArgs e) } /// - /// Handler interface for the + /// Handler interface for the control. /// public new interface IHandler : ListControl.IHandler { - /// - /// Gets or sets a value indicating whether to show the control's border. - /// - /// - /// This is a hint to omit the border of the control and show it as plainly as possible. - /// - /// Typically used when you want to show the control within a cell of the . - /// - /// true to show the control border; otherwise, false. + /// bool ShowBorder { get; set; } } } \ No newline at end of file