Home > DeveloperSection > Forums > Grid DatePicker Column - Width of DatePicker Popup
Manoj Bhatt
Manoj Bhatt

Total Post:153

Posted on    January-28-2014 12:16 AM

 C# C# 

 1 Reply(s)
 897  View(s)
Rate this:

I have a WPF-Grid and a Column with a DatePicker (Windows.Controls.DatePicker). I tried to set the Width/Height of the DatePicker Popup Programmatically.

I want to set the with in my C# Code (not in the xaml). Has someone a idea how i can do this? Is this possible?

Pravesh Singh

Total Post:412

Posted on    January-28-2014 1:00 AM

Hi Manoj,

I take it you are not following the MvvM pattern to achieve desired result.

If you want to set it programmatically you can do it in the constructor of your view and basically do this:

DatePicker datePickerFor2009 = new DatePicker();

datePickerFor2009.SelectedDate = new DateTime(2009, 3, 23);

datePickerFor2009.DisplayDateStart = new DateTime(2009, 1, 1);

datePickerFor2009.DisplayDateEnd = new DateTime(2009, 12, 31);

datePickerFor2009.SelectedDateFormat = DatePickerFormat.Long;

datePickerFor2009.FirstDayOfWeek = DayOfWeek.Monday;

datePickerFor2009.Height = (double)desiredHeight;

datePickerFor2009.Width = (double)desiredWidth;

// root is a Panel that is defined elsewhere.


Don't want to miss updates? Please click the below button!

Follow MindStick