Reputation: 1026
No, I am not having trouble with ActualHeight being set to zero like so many others. In my Windows Store app (WinRT), I see this in the debugger:
ActualHeight | 50.714286804199219 | double
But in my XAML, I have this specified for this element:
<Grid Grid.Column="0" Grid.ColumnSpan="2" x:Name="Headers" Background="{ThemeResource MyAppTitlebarBrush}" Margin="51,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="51"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Height="51">
...
Apparently, something is messing with the numbers but I can't figure out what. The really unfortunate part is that I can't rely on my specified value and therefore can adjust the margin of some other element based on what I think should be a top margin of 51.
I'm not sure where to start debugging this or what I could do that would screw this up. This isn't because the code is catching a height change during an animation. What could it be?
Upvotes: 2
Views: 72
Reputation: 2228
Set UseLayoutRounding
to false, and it should solve it.
Edit: I didn't test it, that's why the should. Also you shouldn't compare doubles with ==
, always use an epsilon for that. (Like Math.Abs(double1-double2) < 0.005
)
Upvotes: 1