Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

grid row actual size problem

$
0
0

Hi, I have a grid with 2 rows. I'm adding them in a code (because it's dynamic grid). So, Each time I add them, I set the Value1* for the 1-st row and Value2* for the second row. After that I must be sure my second row have at list 2 pixels height. To check it, I'm doing simple comparing:

If .RowDefinitions(1).ActualHeight < 2 Then .RowDefinitions(1).Height = GLC.ConvertFromString("2")

And, Hello World! Some magic happens. The ActualHeight is 350, but comparing result is True! and my code is going after Then and set 2 to this row. Here the screenshot from the IDE:


I stopped the code at the line with comparing and move my mouse over the ActualHeight. As you can see here the value of 350.0. Then I'm pressing F11 and the next move is after Then. I thought it's because this object hasn't been added to layout yet. But even if I do the same check after control is built, I have the same problem! Value from the left is always lower than 2!

Here another trick. If I'll set VarA as Double and assign this ActualHeight as value and then I set VarB as Double with value 2, problem still exist.

And the last trick. If I'll try to convert this ActualHeight to String or Integer, guess what? It's became 0. Which is explain everything, except what is going on here?!! If this value in the deepest core is 0, of course it will be < 2. But why it is showing number more than 0 in IDE?

How to solve this problem? How to find ActualHeight of the grid row?

Thanks.


Aleksey



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>