Lightswitch Custom Silverlight Control with Image Binding RRS feed

  • Question

  • I have created a custom silverlight control so that I could create a report for printing that is successfully using data from a details screen within Lightswitch.  

    My next step is to insert an image into my custom control.  This image must be dynamic drawing from a parent table of the details table.  I have inserted the image into the xaml file but even when hard coding it in such as this it doesnt show anything but a blank space area:

                    <Image x:Name="imagecontrolLogo" Height="100" Margin="0,0,331,0" HorizontalAlignment="Left" Width="100" VerticalAlignment="Top"
                    Grid.Column="1" Grid.Row="1"/>

    I am using the C:\ as simply a test.  I have also attempted to use an image I have in Azure Storage but that did not display either.  but regardless, I need this to show an image from the underlying SQL Azure table.  Yes, storing this image in SQL Azure as there will only be one per parent record so should not be very many images at all.  

    So, the question is how do I get this image to dynamically display within this silverlight control according to an SQL Azure Image field?

    I have attempted something like this but did not work:

            Dim imgURI As New Uri("http://testing.blob.core.windows.net/test/test.png")
                imagecontrolLogo.Source = New System.Windows.Media.Imaging.BitmapImage(imgURI)
                imagecontrolLogo.Stretch = Stretch.Uniform
            Catch ex As Exception
            End Try

    Thanks a bunch!

    Edit:  I suppose that I would be okay with storing in Azure Storage if it is easier as well.  Mostly because I have never stored images in SQL Azure, and looks as though I am having some issues with just getting the images in there.

    Edit 2:  Got the image to insert into SQL Azure.  Just need to get it displayed within my Silverlight Control for report printing.

    • Edited by Voyagr12 Tuesday, June 24, 2014 8:38 PM
    Tuesday, June 24, 2014 7:04 PM


All replies