Siticone Year Picker
The SiticoneYearPicker is a dedicated dropdown control for selecting a year.
It simplifies the standard date picker by focusing solely on year selection, ideal for credit card expiration inputs, birth year selectors, or annual report filtering.
Data & Selection
Configure the year range and access the user's choice.
| Property | Type | Description |
|---|---|---|
SelectedYear |
int | The currently selected year (e.g., 2025). |
MinYear |
int | The minimum year available for selection (Default: 1900). |
MaxYear |
int | The maximum year available for selection (Default: 2100). |
InitialValue |
int | The year to display when the control is first loaded or reset. |
Visual Style
Customize the appearance of the input box and the dropdown list.
| Property | Type | Description |
|---|---|---|
YearPickerBackColor |
Color | Background color of the main input box. |
TextColor |
Color | Text color of the displayed year. |
BorderColor |
Color | Color of the control's border. |
SelectedYearBackColor |
Color | Background color of the currently selected year in the dropdown list. |
SelectedTextColor |
Color | Text color of the currently selected year in the dropdown list. |
HoverBackColor |
Color | Background color when hovering over an item in the dropdown. |
Dropdown Configuration
Control the behavior and layout of the popup list.
| Property | Type | Description |
|---|---|---|
DropdownBackColor |
Color | Background color of the dropdown list. |
DropdownMaxHeight |
int | Maximum height of the dropdown list in pixels before scrolling. |
VisibleYearCount |
int | Number of years visible at once in the dropdown without scrolling. |
AutoCloseOnSelection |
bool | If true, the dropdown closes immediately after a year is clicked. |
DropdownTopAligned |
bool | If true, the dropdown opens upwards instead of downwards. |
Events
Handle year changes and user interactions.
// Fired when the selected year changes.
yearPicker.SelectedYearChanged += (s, e) =>
{
Console.WriteLine($"Year changed from {e.OldYear} to {e.NewYear}");
// Example: Validate age
int age = DateTime.Now.Year - e.NewYear;
if (age < 18)
{
lblError.Text = "Must be 18 or older.";
}
};
Designer Support
The control includes a Smart Tag menu in Visual Studio for rapid configuration.
| Category | Features |
|---|---|
Theme Presets |
Apply instant styles: Light, Dark, Corporate Blue, Green, Purple. |
Data Management |
Copy and Paste visual settings between controls. |
Reset |
Reset control properties to their default values. |
Usage Examples
Example 1: Credit Card Expiration
Setup for selecting an expiration year, starting from the current year.
private void SetupExpiryYearPicker()
{
int currentYear = DateTime.Now.Year;
// Allow selection for the next 15 years
yearPicker.MinYear = currentYear;
yearPicker.MaxYear = currentYear + 15;
yearPicker.SelectedYear = currentYear;
// Modern styling
yearPicker.ApplyCorporateBlueTheme();
yearPicker.BorderThickness = 1;
yearPicker.CornerRadiusTopLeft = 4;
yearPicker.CornerRadiusTopRight = 4;
yearPicker.CornerRadiusBottomLeft = 4;
yearPicker.CornerRadiusBottomRight = 4;
}
Example 2: Birth Year Selector
Configuring the picker for selecting a birth year (past dates).
private void SetupBirthYearPicker()
{
int currentYear = DateTime.Now.Year;
// Allow ages from 0 to 120
yearPicker.MaxYear = currentYear;
yearPicker.MinYear = currentYear - 120;
yearPicker.SelectedYear = currentYear - 25; // Default to ~25 years old
yearPicker.PlaceholderText = "Birth Year";
// Use a dark theme
yearPicker.ApplyDarkTheme();
}
Example 3: Custom Styling
Manually applying a custom color scheme (e.g., Green/Success theme).
private void ApplyGreenTheme()
{
yearPicker.YearPickerBackColor = Color.FromArgb(240, 255, 240);
yearPicker.BorderColor = Color.SeaGreen;
yearPicker.TextColor = Color.DarkGreen;
// Dropdown items
yearPicker.DropdownBackColor = Color.White;
yearPicker.SelectedYearBackColor = Color.SeaGreen;
yearPicker.SelectedTextColor = Color.White;
yearPicker.HoverBackColor = Color.Honeydew;
yearPicker.ChevronColor = Color.DarkGreen;
}