C# Class Habanero.Faces.Win.DateRangeComboBoxWin

Provides a selection of common date range options which a user can select from, modifying a start date and end date depending on the selection. The options to choose from, such as "Yesterday", "Last Week" or "This Year", can be modified by the developer. When adding this control, add an event handler on the SelectionChangeCommitted event, and obtain the StartDate and EndDate properties at this time.
NOTE: The start and end dates are the two boundaries of a potential range. Whether they should be inclusive or exclusive depends on the developer and how they are implemented. For instance, if today is Nov 13, Yesterday would provide a start date of Nov 12, 12am and an end date of Nov 13, 12am.
To add additional menu options that aren't available, simply add the new text item to the ComboBox, using Items.Add. When you pick up the SelectionChangeCommitted event, check if the new text string is selected in the Text property and use your own calculations instead of fetching the StartDate and EndDate.
Inheritance: ComboBoxWin, IDateRangeComboBox
Show file Open project: Chillisoft/habanero.faces

Public Methods

Method Description
AddDateOption ( DateRangeOptions option ) : void

Adds a date range option to the current list of options available

DateRangeComboBoxWin ( ) : System

Constructor to initialise a new ComboBox with a selection of date range options that are suited to a timeless system

DateRangeComboBoxWin ( List optionsToDisplay ) : System

Constructor to initialiase a new ComboBox with a specific set of date range options to display

GetDateRangeString ( DateRangeOptions option ) : string

Returns the display string for the date range option supplied

RemoveDateOption ( DateRangeOptions option ) : void

Removes a date range option from the current list of options available

SetDateRangeString ( DateRangeOptions option, string newDisplayString ) : void

Amends the display string for a given date option

SetTopComboBoxItem ( string displayString ) : void

Sets the item in the ComboBox that first appears to the user

UseAllDateRangeOptions ( ) : void

Populates the ComboBox with all available DateOptions, since the default constructor only provides a standardised collection

Method Details

AddDateOption() public method

Adds a date range option to the current list of options available
public AddDateOption ( DateRangeOptions option ) : void
option DateRangeOptions The date range option to add
return void

DateRangeComboBoxWin() public method

Constructor to initialise a new ComboBox with a selection of date range options that are suited to a timeless system
public DateRangeComboBoxWin ( ) : System
return System

DateRangeComboBoxWin() public method

Constructor to initialiase a new ComboBox with a specific set of date range options to display
public DateRangeComboBoxWin ( List optionsToDisplay ) : System
optionsToDisplay List A list of date range options
return System

GetDateRangeString() public method

Returns the display string for the date range option supplied
public GetDateRangeString ( DateRangeOptions option ) : string
option DateRangeOptions The date range enumeration
return string

RemoveDateOption() public method

Removes a date range option from the current list of options available
public RemoveDateOption ( DateRangeOptions option ) : void
option DateRangeOptions The date range option to remove
return void

SetDateRangeString() public method

Amends the display string for a given date option
public SetDateRangeString ( DateRangeOptions option, string newDisplayString ) : void
option DateRangeOptions The date option to amend
newDisplayString string The display string to apply
return void

SetTopComboBoxItem() public method

Sets the item in the ComboBox that first appears to the user
public SetTopComboBoxItem ( string displayString ) : void
displayString string The string to display
return void

UseAllDateRangeOptions() public method

Populates the ComboBox with all available DateOptions, since the default constructor only provides a standardised collection
public UseAllDateRangeOptions ( ) : void
return void