Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Day DropDown

0.00/5 (No votes)
10 Jul 2014 1  
Day Dropdown

Introduction

In this project, I have explained only combobox through year, month and day using C# codebehind.

So let's start…..

Using the Code

Step 1

Open Visual Studio and create a new project like this:

Step 2

Drag and drop three combobox in MainPage.xaml.

Step 3

After that, define the combobox name like 1st combobox name “year”, 2nd one is “month” and 3rd one is “day”.

Step 4

After that, click on “year” combobox and press F4. So combobox property Two Event Fire year_DropDownClosed and year_DropDownOpened.

Step 5

Click on month combobox and fire month_DropDownClosed event.

Step 6

Click on day combobox and fire day_DropDownClosed event.

Step 7

After that, in mainpage constructor, create one method, namely yearinti();

Step 8

In yearinti() method, create one for loop.

In here, the Start of int i = 1900 means the year started of 1900 in “year” combobox.

And i <= DateTime.Now.Year means the loop running between 1900 or current year and create one method of inputyear() in this loop.

Step 9

Count of total year in var x.

Step 10

After that year_DropDownClosed event code like this:

Step 11

After that year_DropDownOpened event code like this:

Step 12

After that month_DropDownClosed event code like this:

Step 13

Check the leap year in CheckLeapYear method through.

Step 14

After that Drag and Drop four textblock in mainpage.xaml.

And namely as shown in image.

And bind the data of the year, month and day combobox in particular textblock:

Step 15

After that day_DropDownClosed event code like this:

Step 16

Run the project:

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here