The City of knowledge
silver light
How to display custom Rightclick context menu in Silverlight controls?
Dec 23rd
When you right click on any Silverlight controls in a web page, it display the default Silverlight context menu which with a single option view the Silverlight Configuration. You may intercept this context menu and display your own menu.
The first step you have to do is, go to the aspx More >
How to play audio or sound files from Silverlight
Dec 23rd
Silverlight provides a class called MediaElement which can be used to play audio or video files.
Silverlight MediaElement supports playing video/audio files in MP3 and WMV formats. The current version of Silverlight does not support .WAV files and .AVI files.
If you attempt to use .WAV or .AVI files with the MediaElement More >
Display Tooltip for Silverlight controls
Dec 23rd
The below sample code shows how to display a simple text tooltip for a Button control:
<Button More >
How to show a popup layer within a Silverlight web page?
Dec 23rd
Add a button to your xaml page as shown below:
<Grid x:Name="LayoutRoot" Background="White" > <Button Width="100" Height="50" x:Name="showPopup" Click="showPopup_Click" Content="Show Popup" /> </Grid>
Add the following code to your code behind file (page.xaml.cs)
Popup p = new Popup();
private void showPopup_Click(object sender, RoutedEventArgs e)
{
// Create a panel control to host More > How to call Javascript functions from Silverlight code ?
Dec 23rd
One of the advantages of Silverlight is, it has access to the Html document of the web page in which it is hosted. This enables Silverlight to access HTML elements in the page and also call Javascript methods.
The following steps shows how to call a Javascript method from Silverlight.
Open the More >
Create WCF service to retrieve session data – part II
Dec 23rd
Create a new Silverlight project with a web project to host the Silverlight control.
Steps:
1. Open Visual Studio and select the menu “File” > “New” > “Project”
2. Select the Project Type as “Silverlight” under your favorite language and choose the template “Silverlight Application”. I have selected Visual C# as the tutorials More >
Access Session variables from Silverlight controls
Dec 23rd
Silverlight controls are client side controls. They get executed on the browser on the client machines and they do not have direct access to the server side data.
Since Session variables live on the web server, Silverlight controls cannot access them directly. However, there are several ways Silverlight can retrieve the More >
Calling WCF from Silverlight controls – Part II
Dec 23rd
This chapter is the continuation of the previous chapter. If you havent read the , please read it before you continue here.
Let us add a new method to our WCF service class, decorated with the [OperationContract] attribute. Add a method as shown below:
[OperationContract]
public string GetName()
{
return "John";
} More > How to call WCF methods from Silverlight controls ?
Dec 23rd
Silverlight controls get executed on the client browser. It does not have direct access to the data on the serverside. So, if your Silverlight controls need to retrieve data from database or other data sources on the server, we have to use various approaches like WCF calls or depend on More >
How to pass parameters to Silverlight controls from ASP.NET pages ?
Dec 23rd
You can pass parameters from your aspx pages and html pages to the Silverlight controls. This chapter explains how to pass parameters to Silverlight controls from your aspx page and code behind files.
InitParameters
The Xaml page user control has a property called InitParameters. You can set a value in the form More >
