C# – Programmatically set Width/Height attribute to “Auto”
by admin 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.
September 9th, 2014 on 08:32
on toggle button i am changing the height of the panel in wpf
Double.NaN is not working. Once the size is 0 then I am not able to change it back to auto. How do i do it?