---
title: "Grid DatePicker Column - Width of DatePicker Popup"  
description: "Grid DatePicker Column - Width of DatePicker Popup"  
author: "Manoj Bhatt"  
published: 2014-01-28  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1896/grid-datepicker-column-width-of-datepicker-popup  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Grid DatePicker Column - Width of DatePicker Popup

I have a [WPF](https://www.mindstick.com/forum/304/wpf)-[Grid](https://www.mindstick.com/forum/369/how-can-i-add-a-column-name-to-my-grid) and a [Column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) with a DatePicker (Windows.Controls.DatePicker). I tried to set the Width/Height of the DatePicker [Popup](https://www.mindstick.com/blog/11734/how-to-create-advanced-popup-or-banners-with-news-images-discounts-in-magento2) Programmatically.

I want to set the with in my [C# Code](https://www.mindstick.com/forum/403/how-to-export-data-in-excel-file-from-sql-server-using-c-sharp-code) (not in the xaml). Has someone a idea how i can do this? Is this possible?

## Replies

### Reply by Pravesh Singh

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.root.Children.Add(datePickerFor2009);
```


---

Original Source: https://www.mindstick.com/forum/1896/grid-datepicker-column-width-of-datepicker-popup

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
