How to use .js and .css file in SilverLight application - silverlight

I am using a customized alert message for my whole application which generates from a .js file and a .css file. I have also used silverlight in my application and shows MessageBox from silverlight with its default design. Now i want to customized that MessageBox in silverlight.
So, can anyone plz help me to know how to add js and css file to silverLight application and how to use it

You can't change the built-in MessageBox style as easily as simply creating your own modal window. There are lots of custom messageboxes about and many have source code.
e.g.
Creating a reusable MessageBox dialog.
Silverlight Modal Dialog With Custom User Controls
Custom MessageBox Control for Silverlight 3
Note: these are all Silverlight solutions, so you are authoring in XAML and with style, not using JS and CSS.
It is also possible to call JS functions on the page from within Silverlight if you think that will be easier for your solution.

Related

WebBrowser in C# winforms lagging

I'm currently building a desktop app using C# winforms. One of the requirement is to display the client's website on a form, so I've just added a webbrowser widget.
This webpage seems to "lag" a lot, all CSS or JQuery animations seems jaggy. I tried to open the page in IE and it doesn't lag that much.
Is there any option I need to pass to the webbrowser widget to make it more faithfull ? Some double buffering, or any other kind of parameters that I could use ?

Wpf Modern Ui Not Responding message in window header issue?

In above image i am using Wpf ModernUi template, while form is not responding the UI changes like normal wpf window. If any one knows how to fix this kindly share.

Show Background Image While Loading Silverlight Application

I have a Silverlight app that takes a few seconds to display on a webpage. While loading, the user sees a blank space. Is there a way to show some sort of alt text or background image behind the application while it is loading to indicate to the user what is happening?
Check that out :
http://msdn.microsoft.com/en-us/library/cc903962(VS.95).aspx
Based on the above link posted by danbord, I found that this can be accomplished via a splash screen. Basically, the splash screen will be loaded while the .xap is still being downloaded for a silverlight application. This can be implemented as follows:
Create splash screen .xaml file (this can be done in Visual Studio by creating a Silverlight 1.0 JScript page)
Add a splashScreenSource parameter to your object tag in the webpage hosting your silverlight application. This should point to the .xaml file created in step 1.
It is important that the value of the splashscreen param resolve to the correct location of the .xaml file relative to the page the silverlight app is hosted in. For example, if your SplashScreen.xaml file is in your website root, but the page hosting your silverlight app is in a subfolder, you will need to use
<param name="splashScreenSource" value="../SplashScreen.xaml" />
There are also other options that can be added such as attaching an event handler to the onSourceDownloadProgressChanged event to update a progress bar or some other UI animation.

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.

Display modal Silverlight popup on HTML button click

I have the following desired workflow: on HTML button click a Silverlight modal popup (dialog) must be displayed. No Silverlight content is displayed before HTML button click and no Silverlight content must be displayed after exiting from modal SL popup.
According to our customer inclination we couldn't use another technology for such popups.
Any thoughts on how to accomplish mentioned workflow?
I'm quite new to Silverlight so all the ideas are highly appreciated.
The requirement is a little unusual, but here goes...
I am assuming you have a Silverlight test project and know enough HTML/JScript to popup a window, as you tagged this question as Silverlight only.
Think of Silverlight as just another component you can put on a web page. Any web page. It can be a small control, or fill a HTML window.
In your case you want to simply put your Silverlight startup code into a html page that a popup window can show. The popup window will be triggered by JScript attached to a button.
The Silverlight startup code is usually generated for you in a HTML test webpage in your Silverlight Webproject. Copy it from there.
If you need more detailed instructions for a specific example, please provide more detail.

Resources