<StackPanel x:Uid="Style_1" x:Name="ForAdsImagePath" Grid.Row="1" Orientation="Horizontal" Margin="0,17,0,0" Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Stretch">
<Image x:Name="img1" Source="http://xxx.xxx.xxx.com/www/deliver/xxx.php?zoneid=9&cb=131441234131313&n=a25d26ed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseLeftButtonDown="Image_MouseLeftButtonDown"/>
</StackPanel>
How do I write code for binding an image source in C#
.
I tried this step but it gets an error upon initializing:
Source="{Binding Path, Converter={StaticResource MyPathConverter}}"
private void MyPathConverter()
{
try
{
string Path = @"http://qa-ads.transim.com/www/delivery/avw.php?zoneid=9&cb=131441234131313&n=a25d26ed";
Image image = new Image();
image.UriSource = new Uri(Path);
}
catch (Exception ex) { /*Ignoe Function*/ }
}