beta.blog

Archive for February, 2013

C# – Programmatically set Width/Height attribute to “Auto”

by on Feb.22, 2013, under Programming

I’ve noticed the .Width or .Height attribute expects a Double value in WPF. In contrast to XAML it’s therefor impossible to set one of these attributes to “Auto”. Luckily there’s another way of setting it to Auto from C-Sharp code:

ListView1.Width = Double.NaN;

Double.NaN (or double.NaN) pretty much has the same effect as the Auto attribute in XAML.

1 Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!