Kevin McNeish Blog

All things iOS, Kindle and .NET

Recent Posts



  • First books in my new book series, "iOS App Development for Non-Programmers" are now available! iBookStore: Amazon: Amazon:


Email Notifications


WPF: Setting the Height or Width to Auto in Code

At times, you may want to programmatically set the Height or Width of a WPF element to Auto in code. To do this, just use the Double.NaN (Not a Number) value.

For example, in C#:

this.txtName.Width = Double.NaN;

And in VB .NET:

Me.txtName.Width = Double.Nan

Best Regards,
Kevin McNeish
INETA Speaker
Chief Architect, MM .NET Application Framework




Jim said:

Thank you!

# June 28, 2011 6:25 AM

Cesar said:


# August 20, 2013 8:06 AM
Leave a Comment





If you can't read this number refresh your screen
Enter the numbers above: