as the title above..
what should i do in order to add a image into my .aspx by using silverlight?

Recommended Answers

All 9 Replies

Can you explain what you mean? Do you want to add an image, or do you want to add a .xap (Silverlight file) displaying an image?

hmm..
i think is to add the .xap to display an image...
is it must to add the.xap to display an image in .aspx?

No. You can just display a regular image with HTML. Silverlight is not required.

what if i want to use silverlight to insert image into my .aspx page?
assignment required.

You need to create a Silverlight project in Visual Studio and go from there (or use Blend). When you are done, embed the xap file in your aspx page.

I've tried it..

this is my Payment.aspx

<head runat="server">
    <script src="Silverlight.js" type="text/javascript"></script> 

    <title>Payment</title>
    <script language="jscript" type="text/jscript">
         createSilverlightPlugin('paymentSilverlightPluginHost', '400', '1000', 'PaymentHeader.xaml')
    </script>
    <script type="text/javascript">
        function createSilverlightPlugin(placeHolder, width, height, xamlfile) {
            var parentElement = document.getElementById(placeHolder);
            Silverlight.createObject
            (
                xamlfile,
                parentElement,
                placeHolder,
                {
                    width: width,

                    height: height,

                    inplaceInstallPrompt: false,


                    isWindowless: 'false',

                    framerate: '24',
                    version: '1.0'
                },
                {
                    onError: null,
                    onLoad: null
                },
                null
            );
        }
    </script>
</head>
<body>
    <form id="frmPayment" runat="server">
        <div id="paymentSilverlightPluginHost">
            <asp:Image ID="imgPaymentHeader" runat="server"/>
        </div>

and this is my .xaml code

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"
        xmlns:local="clr-namespace:Olympia_Open_College">
    <Image Canvas.Left="47" Canvas.Top="89" Height="150" Stretch="Fill" Width="200" Source="/Images/PaymentHeader.png"></Image>
</Canvas>

and the problem was occured about the .xaml code..
the Source is not part of the project..... and so on..
and when i execute it...
a JScript runtime error: Obejct Expected and highlighted
createSilverlightPlugin('paymentSilverlightPluginHost', '400', '1000', 'PaymentHeader.xaml')

can i what is it problem? how do i solve it?s

I'm not familiar with the construct you are using, hope someone else can help.

if is you what would you suggest me to do with it? by using silverlight insert a image into the .aspx page.

now i solved the problem already, by using .xap file..
but i got a doubt can i create 2nd .xap file and embed it with another .aspx page?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.