I have a silverlight application in which I am using the windowless property to show text .
Silverlight Plugin Size is 1000*2000, I Have a button (siverlight control) on the Top.
I am showing some html text using DIV real time. Its working fine.
My Silverlight Plugin & DIV both style property is= "position:absolute'.
This application is working fine in IE, but When I run this application in Firefox Button doesn't dsiplayed.
Please let me know whats a issue with Firefox ?
Thanks in advance,
Laxmilal
In your html, specify following code in CSS
html {
height: 100%;
}
body {
height: 100%;
padding: 0;
margin: 0;
min-width: 800px;
min-height: 600px;
}
#silverlightControlHost {
height: 100%;}
Then in the body
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="SOURCE OF YOUR XAP"/>
<param name="autoUpgrade" value="true" />
<!--Your other para-->
</object>
Related
Current behavior
When embedding and loading Silverlight.xap directly inside an HTML page, it works fine. But when we move same code inside a component, it won't load the Silverlight. DOM in both cases, i.e. embedding and loading through HTML and through component, doesn't show any difference.
Code of Silverlight-app.Component.HTML Page
When we load this page directly, i.e. localhost/OurApp/Silverlight-app.Component.HTML, silverlight content gets loaded and it works fine. But when we open index.html in browser (which is main component of our angular2 and Silverlight-app.Component.HTML page is child component of index.html), it don't load silverlight content.
<section>
<div>
<object id="silverlightControlHost" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%" style="min-height: 100%; height: 1000px">
<param name="source" value="clientbin/SilverlightApp.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<param name="Windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration: none">
<img src="images/slmedallion.png" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object>
<iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
border: 0px"></iframe>
<iframe id="desktop" style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
</div>
</section>
Expected/desired behavior
Embedding and loading Silverlight component should have same behavior irrespective of loading through HTML or through component.
What is the motivation / use case for changing the behavior?
We are migrating our Silverlight application to Angular2. As complete migration will take months, we are keeping some of the silverlight modules as well.
Images for better understanding of the issue
this example does exactly what you need :)
https://github.com/lohiarahul/Angular2-Silverlight-Starter
The below code we are using for silver light image display in a div. It's working fine in IE8. But we have an issue with IE11. The image overlapping from the parent div it's not coming inside the div. Can any one fix this issue?
<div id="imgDiv" class="divBrd" style="width: 600px; height: 247px; overflow: auto;">
<div id="tr2">
<div id="divImage" onclick="clipimage(this);" style="overflow: hidden; width: 790px; height: 250px;">
<object type="application/x-silverlight" data="data:application/x-silverlight," id="divImageID" width="780" height="250px">
<param name="background" value="#ffffff">
<param name="Stretch" value="Fill">
<param name="source" value="../ClientBin/ImageHand.xap?v=7af70000-adb3-4167-b945-bf67a28a2186">
<param name="initParams" value="PageId=1,SeqNo=3,SubSeqNo=0,Width=780,Height=250,Container=divImage">
<param name="windowless" value="true">
<param name="maxFramerate" value="24">
</object>
</div>
</div>
</div>
Thanks,
Pandiyan
I am using a jQuery Dialog in a web application that uses Silverlight on several pages. When the dialog appears on pages with a SL window, the dialog is hidden behind the SL. I cannot use windowless mode. Is there any straight-forward way to make this dialog appear in front of SL?
You can always create a floating div of the same size as the dialog. It will be above the silverlight plugin. You'll also need code to dismiss the div when the dialog is closed.
The dialog will be part of the div and therfore float above it above the silverlight.
It appears to work fine using an iframe doing similar to what you explained with the floating div.
It might needs tweaking, but hopefully this can help others.
On your page, include an iframe like so:
<div id="popupDiv" style="display: none">
popup contents...
</div>
<iframe id='popupSupporter-iframe' tabindex='-1' frameborder='0' style='display: block;
position: absolute; z-index: -1; border: 0px none transparent; opacity: 0; top: auto;
left: auto; width: auto; height: auto;'></iframe>
And in the script portion where you declare your dialog:
$('#popupDiv').dialog({
open: function (event, ui) {
var myDialogIFrame = $('#popupSupporter-iframe');
var myDialog = $('#popupDiv').dialog("widget");
myDialogIFrame.css("z-index", "10");
var left = myDialog.offset().left + 'px';
var top = myDialog.offset().top + 'px';
var height = (myDialog.height() + 15) + 'px';
var width = (myDialog.width() + 15) + 'px';
$(myDialogIFrame).css("left", left).css("top", top).css("height", height).css("width", width);
},
close: function (event, ui) {
$('#popupSupporter-iframe').css("z-index", "-1");
}
});
Setting the following values for background and windowless attributes for the silverlight application worked for me :)
<param name="background" value="transparent" />
<param name="windowless" value="true" />
I'm working on a Silverlight 4 application that seems to run fine in IE and Google Chrome, however when I try to view the application in Firefox, the application loads, but is not visible. The application is definitely loading, despite not being visible. Then I changed the height and width of Object from 100% to fixed, then its come showing in Firefox.
How can I view Silverlight applications in Firefox with maximum height and width?
In your html, specify following code in CSS
html {
height: 100%;
}
body {
height: 100%;
padding: 0;
margin: 0;
min-width: 800px;
min-height: 600px;
}
#silverlightControlHost {
height: 100%;
}
Then in body
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="SOURCE OF YOUR XAP"/>
<param name="autoUpgrade" value="true" />
<!--Your other para-->
</object>
</div>
Hope this works for you.
When running our Silverlight 3 application out-of-browser, startup takes a little time, but it's long enough to be noticeable. During this startup, the background of the window hosting the application displays an ugly white background color. When running in-browser, we have a splash screen, but that's loaded via JavaScript of course. How can I get a splash screen working for an out-of-browser Silverlight 3? Or if that's not possible, is there a way I can at least change the background color of the window?
I actually found a way to do this. Hooray! Much credit goes to the document found at this page. Note that we're distributing our application on disk; these instructions won't work for a Silverlight application installed by a user from the web.
It turns out that the Silverlight launcher loads an HTML page at the start. Where the application gets installed, there's an index.html file. The page contains an <object> tag similar to the one used to host Silverlight on the Web.
Unfortunately, this <object> does not support the Silverlight splash screen XAML or progress indicator, which I guess is to be expected since the XAP isn't being downloaded. Also, setting the background color of the page or of the <object> also doesn't seem to take effect. However, it turns out that it's just that Windows immediately starts drawing the plugin, so the default window color is shown while doing so.
To work around this, I set the visibility of the <div> that hosts the Silverlight to hidden. Then, at the bottom of the HTML, I added a <script> that sets a timer. When the timer fires, the visibility of the <div> is changed to visible, and the Silverlight object is given focus. Even if the timer is set to 1 millisecond, that allows the HTML's host a chance to do the initial drawing of the web page. That allows any content underneath the Silverlight to show up.
Here's my entire HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<style type="text/css">
html, body { height: 100%; overflow: hidden; background-color: black; }
body { padding: 0; margin: 0; }
#silverlightControlHost
{
height: 100%; visibility: hidden; position: absolute;
}
#splashScreen
{
background-image: url('blah.png');
background-repeat: no-repeat;
width: 575px;
height: 330px;
top: 185px;
left: 212px;
color: white;
position: absolute;
font-family: Arial, Sans-Serif;
}
#loadingText
{
position: relative;
top: 165px;
text-align: center;
font-size: 18px;
}
</style>
</head>
<body scroll="no">
<div id="silverlightControlHost">
<object id='_sl' data="data:application/x-silverlight," type="application/x-silverlight" width="100%" height="100%">
<param name="source" value="offline://1931574666.localhost"/>
<param name="background" value="Black"/>
<param name="enableGPUAcceleration" value="True"/>
<a href="http://go.microsoft.com/fwlink/?LinkID=124807"
style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181"
alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
</div>
<div id="splashScreen">
<div id="loadingText">Loading. Please wait...</div>
</div>
<script>
setTimeout(
function() {
var ctrl = document.getElementById("silverlightControlHost");
ctrl.style.visibility = "visible";
document.getElementById('_sl').focus();
},
3000
);
</script>
</body>
</html>
Unfortunately, Silerlight 3 does not provide a way to customize this.