In Xaml code, I set the width and height of an Image to Auto. Then, in code-behind, I sometime have to set it to different values. But how can I set it back to Auto in codebehind?
This is how it looks in the xaml code:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Image x:Name="FlickrImage"/>
And in codebehind:
FlickrImage.Source = new BitmapImage(new U开发者_开发技巧ri("/Images/error_image.png", UriKind.Relative));
FlickrImage.Width = 128;
FlickrImage.Height = 128;
But after this, I want to set it back to Auto. Can anyone please give me a hand?
Check out this earlier SO question
How to say XAML <Button Height="Auto"/> in code behind?
You set it to double.NAN
精彩评论