Floating FB sharing byReview Results

Floating FB sharing byReview Results

  • WPF Tutorial

    • # Read in Your Language

    WPF Controls

    Tutorial Home | Layouts | Containers | Button | CheckBox and CheckedListBox | ComboBox | DateTimePicker and MonthCalendar | DataGrid | Label and LinkLabel | ListBox | ListView | TextBox and MaskedTextBox | PictureBox and ProgressBar | TreeView | WebBrowser | Menus,Status and Toolbar | RadioButton | RichTextBox | ToolTip and Scrolling | Custom Controls

    DateTimePicker and MonthCalendar controls in WPF

    DatePicker (or) MonthCalendar:

    Namespace : System.Windows.Controls.DatePicker
    DatePicker that let user to set the date and handles events for date selection.

    Designer Code:

            <DatePicker Height="25" HorizontalAlignment="Left" Name="datePicker1" 
                VerticalAlignment="Top" Width="115" />
                IsDropDownOpen="True" <!-- To open the drop down>

    Code Behind:

    To retive the selected date from the DatePicker:

            // Window1.xaml.cs
    private void datePicker1_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { MessageBox.Show(datePicker1.SelectedDate.ToString()); } //Other properties datePicker1.DisplayDate = new DateTime(2012, 5, 5); datePicker1.DisplayDateStart = new DateTime(2012, 5, 2); datePicker1.DisplayDateEnd = new DateTime(2012, 5, 31); datePicker1.FirstDayOfWeek = DayOfWeek.Monday;


    To make collection of dates not avalible set this property.

                    <CalendarDateRange Start="5/3/2012" End="5/7/2012"/>
                    <CalendarDateRange Start="5/11/2012" End="5/13/2012"/>

    Code Behind:

    BlackoutDates from code:

            // Window1.xaml.cs
    datePicker1.BlackoutDates.Add(new CalendarDateRange( new DateTime(2012, 3, 5), new DateTime(2012, 8, 5) ));

    Multiple Date Selection:


    Image as Background of a DatePicker:

                 <ImageBrush ImageSource="Images\win2wpf.JPG" Opacity="0.5"/>


    No direct equivalent in WPF.Use Windows forms host for this
    Add references to WindowsFormsIntegration.dll from program files\reference assemblies and System.Windows.Forms from the .net tab.

    WindowsFormsHost integration for DateTimePicker:
      <Window x:Class="WindowsApplication1.Window1"

    There is control avaliable in codeplex, Link:http://datetimepickerwpf.codeplex.com/

    << Previous >> | << Next >>