This project is read-only.

Loading Vertigo.Slideshow.xap from another xap

Jul 29, 2010 at 1:03 PM

Hi Guys,

I would like to use this library as part of my own Silverlight Application,

I have looked at Dynamic Loading and think this could be the way to do it,

Is this possible? 

If so what Instance should I create in the assembly?

If there is an easier way to do it or have anyone has done it then please share it here,

Thanks,

Dave.

Aug 4, 2010 at 4:05 PM
Edited Aug 4, 2010 at 4:15 PM

Hi Dave,

The slides can be dynamically loaded from a database or other source.  The trick is to use a web page that writes its output as xml.

In your HTML you will refer to the new webpage as the dataprovider.  Something like:

DataProvider=XmlDataProvider;Path=/SlideShowXML.aspx?ID=999999

For the XML, Open a new ASPX page leaving the HTML portion completely blank,except for the @page declaration:

Then in the Code Behind, use the code pasted below

Good Luck!

 

Imports System.Text
Imports System.Data

Partial Class SlideSHowXML
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim ID As Integer = CInt(Request.QueryString("ID"))

        Dim dt As New DataTable
        Dim dr As DataRow

        ***Load your datable here***

        Dim xml As New StringBuilder

        xml.AppendLine("<?xml version='1.0' encoding='utf-8' ?>")
        xml.AppendLine("<data transition='CrossFadeTransition'>")
        xml.AppendLine("<album ")
        xml.AppendLine("title = ''")
        xml.AppendLine("description = ''")
        xml.AppendLine("source='" & dt.Rows(0)("PhotoURL") & "'>")

        For Each dr In dt.Rows
            xml.AppendLine("<slide")
            xml.AppendLine("title = '" & dr("PhotoURL") & "'")
            xml.AppendLine("source = '" & dr("PhotoURL") & "'")
            xml.AppendLine("thumbnail='" & dr("PhotoURL") & "' />")
        Next
        xml.AppendLine("</album>")
        xml.AppendLine("</data>")


        Try
            Response.ContentType = "text/xml"
            Response.Write(xml.ToString)
        Catch ex As Exception

        End Try
    End Sub


End Class