How can my controls size be NaN when it is actually shown?
Posted
by Stian Karlsen
on Stack Overflow
See other posts from Stack Overflow
or by Stian Karlsen
Published on 2010-03-09T11:47:45Z
Indexed on
2010/03/09
11:51 UTC
Read the original article
Hit count: 252
I have a Grid which contains an Image in one of its columns. The image itself does not have any Width or Height set, but its size is correctly controlled through the ColumnDefinition set. From this I would assume that the image controller actually has a Width and Height set, but when I try to bind another element to its Width and Height it doesn't work. When debugging it turns out that the value of Image.Height and Image.Width are NaN. Why?
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="350"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">
<Image x:Name="_image" Source="image.jpg"></Image>
</Grid>
</Grid>
© Stack Overflow or respective owner