Image Control Bind Generated Imageurl

Hey this is my first question here because I really don't find an answer to my problem. I usually check forums, google and all of this stuff 5 times, but in this case I didn't find any solution because I don't have the keywords I think ....

Problem: I got Image Control in my WP7 app and tried to include a Uri that looks like this:

http://veranstaltungen.meinestadt.de/images/image.php?origin=events&mode=G&id=71080093

The problem is that this image is not being loaded by the control. Images like this

http://www.design-center.de/wp-content/uploads/2012/09/IMG_1113.jpg-mini.jpg

loaded without problems.

Any idea for a workaround or other control?

thanks in advance

<DataTemplate>
      <controls:PivotItem Margin="0,0,0,0">
             <ScrollViewer VerticalScrollBarVisibility="Visible">
                    <StackPanel Name="contentPanel"  Margin="12,0,12,0">
                            <TextBlock x:Name="PartyTitle" Text="{Binding title}" Margin="10,0,0,10" Style="{StaticResource PhoneTextTitle2Style}" TextWrapping="Wrap"/>
                            <Image x:Name="PartyImage" Source="{Binding imgUrl}" Margin="10,0,0,10" ></Image>
                            <TextBlock x:Name="PartyDescription" Margin="10,0,0,10"  Text="{Binding text}" TextWrapping="Wrap" />
                            <Button x:Name="PartyLink" DataContext="{Binding urls[0]}" Content="Link" Click="PartyLink_Click"></Button>
                    </StackPanel>
             </ScrollViewer>
      </controls:PivotItem>
</DataTemplate>

      

Binding and stuff works well for all controls.

+3


source to share


1 answer


You can download the image in the code behind and set it as source. I'll post an example.

This should work, but my network adapter is not working on the emulator. Its always something.

  WebRequest req = WebRequest.Create("http://www.leenwallpapers.com/images/gallery/funny0152.jpg");
         req.BeginGetRequestStream(new AsyncCallback(test), null);

      



HttpWebRequest = (HttpWebRequest) ar.AsyncState;

        // End the operation
        Stream postStream = request.EndGetRequestStream(ar);
        BitmapImage img = new BitmapImage();
        img.SetSource(postStream);
        imgtest.Source = img;

      

In this case, imgtest is the x: name of the image control in my xaml. You can of course do this in view mode and imgtest can be set by the bitmapimage attribute and change the property of the property.

0


source







All Articles