Skip to content

Commit d210b50

Browse files
authored
Merge pull request #2431 from Miepee/datetime-doc
Revise DateTimePicker documentation
2 parents 8fcfdbe + a8b2634 commit d210b50

File tree

2 files changed

+31
-63
lines changed

2 files changed

+31
-63
lines changed

src/Eto/Forms/Controls/Control.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ public static implicit operator Control(Image image)
14801480

14811481
static readonly object callback = new Callback();
14821482
/// <summary>
1483-
/// Gets an instance of an object used to perform callbacks to the widget from handler implementations
1483+
/// Gets an instance of an object used to perform callbacks to the widget from handler implementations.
14841484
/// </summary>
14851485
/// <returns>The callback instance to use for this widget</returns>
14861486
protected override object GetCallback() { return callback; }

src/Eto/Forms/Controls/DateTimePicker.cs

+30-62
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,56 @@
55
namespace Eto.Forms;
66

77
/// <summary>
8-
/// Modes for the <see cref="DateTimePicker"/>
8+
/// Available modes for how a <see cref="DateTimePicker"/> can be displayed.
99
/// </summary>
1010
[Flags]
1111
public enum DateTimePickerMode
1212
{
1313
/// <summary>
14-
/// Show only the date component
14+
/// Only the date component will be shown.
1515
/// </summary>
1616
Date = 1,
1717
/// <summary>
18-
/// Show only the time component
18+
/// Only the time component will be shown.
1919
/// </summary>
2020
Time = 2,
2121
/// <summary>
22-
/// Show both the date and time components
22+
/// Both the date and time components will be shown.
2323
/// </summary>
2424
DateTime = Date | Time
2525
}
2626

2727
/// <summary>
28-
/// Date/time picker control to enter a date and/or time value
28+
/// A control that allows the user to select a date and/or a time.
2929
/// </summary>
30+
/// <example>
31+
/// Here is an example that creates a date/time picker, where the user will only be able to choose between two dates:
32+
/// <code>
33+
/// var dateTimePicker = new DateTimePicker () { MinDate = DateTime.Now, MaxDate = DateTime.Now.AddYears(2) };
34+
/// </code>
35+
/// </example>
3036
[Handler(typeof(DateTimePicker.IHandler))]
3137
public class DateTimePicker : CommonControl
3238
{
3339
new IHandler Handler { get { return (IHandler)base.Handler; } }
3440

3541
/// <summary>
36-
/// Occurs when the <see cref="DateTimePicker.Value"/> property has changed by the user
42+
/// Occurs when the <see cref="DateTimePicker.Value"/> property has changed by the user.
3743
/// </summary>
3844
public event EventHandler<EventArgs> ValueChanged;
3945

4046
/// <summary>
4147
/// Raises the <see cref="ValueChanged"/> event.
4248
/// </summary>
43-
/// <param name="e">Event arguments</param>
49+
/// <param name="e">Event arguments.</param>
4450
protected virtual void OnValueChanged(EventArgs e)
4551
{
4652
if (ValueChanged != null)
4753
ValueChanged(this, e);
4854
}
4955

5056
/// <summary>
51-
/// Gets or sets the minimum date entered
57+
/// Gets or sets the minimum date that is allowed to be entered.
5258
/// </summary>
5359
/// <value>The minimum date.</value>
5460
public DateTime MinDate
@@ -58,7 +64,7 @@ public DateTime MinDate
5864
}
5965

6066
/// <summary>
61-
/// Gets or sets the maximum date entered
67+
/// Gets or sets the maximum date that is allowed to be entered.
6268
/// </summary>
6369
/// <value>The maximum date.</value>
6470
public DateTime MaxDate
@@ -68,7 +74,7 @@ public DateTime MaxDate
6874
}
6975

7076
/// <summary>
71-
/// Gets or sets the value of the date/time picker. Null to display blank or with a unchecked checkbox.
77+
/// Gets or sets the value of the date/time picker. <see langword="null"/> to display blank or with a unchecked checkbox.
7278
/// </summary>
7379
/// <value>The current value.</value>
7480
public DateTime? Value
@@ -96,7 +102,7 @@ public DateTime? Value
96102
}
97103

98104
/// <summary>
99-
/// Gets or sets the mode of the date/time picker.
105+
/// Gets or sets the mode of how the date/time picker will be displayed.
100106
/// </summary>
101107
/// <value>The picker mode.</value>
102108
[DefaultValue(DateTimePickerMode.Date)]
@@ -106,13 +112,7 @@ public DateTimePickerMode Mode
106112
set { Handler.Mode = value; }
107113
}
108114

109-
/// <summary>
110-
/// Gets or sets the color of the text.
111-
/// </summary>
112-
/// <remarks>
113-
/// By default, the text will get a color based on the user's theme. However, this is usually black.
114-
/// </remarks>
115-
/// <value>The color of the text.</value>
115+
/// <inheritdoc cref="TextControl.TextColor"/>
116116
public Color TextColor
117117
{
118118
get { return Handler.TextColor; }
@@ -124,10 +124,9 @@ public Color TextColor
124124
/// </summary>
125125
/// <remarks>
126126
/// This is a hint to omit the border of the control and show it as plainly as possible.
127-
///
128127
/// Typically used when you want to show the control within a cell of the <see cref="GridView"/>.
129128
/// </remarks>
130-
/// <value><c>true</c> to show the control border; otherwise, <c>false</c>.</value>
129+
/// <value><see langword="true"/> to show the control border; otherwise, <see langword="false"/>.</value>
131130
[DefaultValue(true)]
132131
public bool ShowBorder
133132
{
@@ -136,20 +135,17 @@ public bool ShowBorder
136135
}
137136

138137
static readonly object callback = new Callback();
139-
/// <summary>
140-
/// Gets an instance of an object used to perform callbacks to the widget from handler implementations
141-
/// </summary>
142-
/// <returns>The callback instance to use for this widget</returns>
138+
139+
/// <inheritdoc/>
143140
protected override object GetCallback() { return callback; }
144141

145142
/// <summary>
146143
/// Callback interface for the <see cref="DateTimePicker"/>.
147144
/// </summary>
148145
public new interface ICallback : CommonControl.ICallback
149146
{
150-
/// <summary>
151-
/// Raises the value changed event.
152-
/// </summary>
147+
/// <summary><inheritdoc cref="DateTimePicker.OnValueChanged"/></summary>
148+
// TODO: parameters
153149
void OnValueChanged(DateTimePicker widget, EventArgs e);
154150
}
155151

@@ -158,9 +154,7 @@ public bool ShowBorder
158154
/// </summary>
159155
protected new class Callback : CommonControl.Callback, ICallback
160156
{
161-
/// <summary>
162-
/// Raises the value changed event.
163-
/// </summary>
157+
/// <inheritdoc cref="ICallback.OnValueChanged"/>
164158
public void OnValueChanged(DateTimePicker widget, EventArgs e)
165159
{
166160
using (widget.Platform.Context)
@@ -175,48 +169,22 @@ public void OnValueChanged(DateTimePicker widget, EventArgs e)
175169
/// </summary>
176170
public new interface IHandler : CommonControl.IHandler
177171
{
178-
/// <summary>
179-
/// Gets or sets the value of the date/time picker
180-
/// </summary>
181-
/// <value>The current value.</value>
172+
/// <inheritdoc cref="DateTimePicker.Value"/>
182173
DateTime? Value { get; set; }
183174

184-
/// <summary>
185-
/// Gets or sets the minimum date entered
186-
/// </summary>
187-
/// <value>The minimum date.</value>
175+
/// <inheritdoc cref="DateTimePicker.MinDate"/>
188176
DateTime MinDate { get; set; }
189177

190-
/// <summary>
191-
/// Gets or sets the maximum date entered
192-
/// </summary>
193-
/// <value>The maximum date.</value>
178+
/// <inheritdoc cref="DateTimePicker.MaxDate"/>
194179
DateTime MaxDate { get; set; }
195180

196-
/// <summary>
197-
/// Gets or sets the mode of the date/time picker.
198-
/// </summary>
199-
/// <value>The picker mode.</value>
181+
/// <inheritdoc cref="DateTimePicker.Mode"/>
200182
DateTimePickerMode Mode { get; set; }
201183

202-
/// <summary>
203-
/// Gets or sets the color of the text.
204-
/// </summary>
205-
/// <remarks>
206-
/// By default, the text will get a color based on the user's theme. However, this is usually black.
207-
/// </remarks>
208-
/// <value>The color of the text.</value>
184+
/// <inheritdoc cref="DateTimePicker.TextColor"/>
209185
Color TextColor { get; set; }
210186

211-
/// <summary>
212-
/// Gets or sets a value indicating whether to show the control's border.
213-
/// </summary>
214-
/// <remarks>
215-
/// This is a hint to omit the border of the control and show it as plainly as possible.
216-
///
217-
/// Typically used when you want to show the control within a cell of the <see cref="GridView"/>.
218-
/// </remarks>
219-
/// <value><c>true</c> to show the control border; otherwise, <c>false</c>.</value>
187+
/// <inheritdoc cref="DateTimePicker.ShowBorder"/>
220188
bool ShowBorder { get; set; }
221189
}
222190

0 commit comments

Comments
 (0)