Column widths are specified in different ways (Stars, Auto etc) How to get the width in pixels of a specific column?
GridLength l=tip.basis.ColumnDefinitions[0].Width;
You can use the ActualWidth
or ActualHeight
property of elements to get the width/height of elements. This answer describes the difference between `'ActualWidth' and 'Width'.
So in the above example it would be:
Double width = tip.basis.ColumnDefinitions[0].ActualWidth;
And also keep in mind that WPF uses Device Independent Pixels, as described in this answer.
The ActualWidth
property should provide the width of the column in Pixels
MSDN Page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With