Distributing WCF features in the SilverLight Application
Go to solution explorer right click on silverlight foler
click on ‘add. Service reference
Address: http: //loathes : /003 / servicel.svc
Click on go button click on ok button
Note
By default the Microsoft given namespace name is ‘service reference1’
Go to main page .XAML code behind window
Using silverlight application 53. Service reference1;
Namespace silverlight application 53
{
Public partical class mainpage: user control
{
Public mainpage()
{
Initialize component ();
Service 1 client obj = new service 1 client();
Obj. add str completed + = new event handler <addstrcompleted eventargs>
(obj_addstrcompleted);
Obj.addstraasyncc);
}
Strubg s;
Void obj_add strcompleted (object sender, addstr completed event args e)
{
S = e.result . tosting();
}
Private void button_click (object sender, routed eventrags e)
{
Textbox1.text = s;
} } }
Note:-
while declaring addstrcompleted event press two times tab key after giving “+=
Using addstrcompleted event eventArgs parameter we can get WCF method data
Effects In the SilverLight
Effects are used to give rich interactive web graphical features, the silver light support two types of effects
- Blur effect
- Shadow effect
SilverLight Blur Effect
Open new silver light application
Go to XAML mode
In the canvas tag
<canvas>
<button X:name = “b1” height = “100” width = “250” content = “welcome” fontsize = “36” click = “b1- click”>
<button. Effect>
<blur effect radius = “100” > </bluer effect >
</button. Effect>
</button>
</canvas>
Blur Effect giving at Runtime
Go to button click event
Using system. Windows. Media. Effects;
Private void bl-clicks (objet sender, routed event args e )
{
If (bl.effect == null)
{
Blur effect b = new blureffet ();
b.radius = 100;
- Effect = b;
}
Else
{
Bl. Effect = null;
}
}
SilverLight Shadow Effect
Open new silverlight application
Go to SAML mode
In the canvas tag
<canvas>
<button X: name = “bi” Height = “100” width = “250” content = “welcome” font size = “40” canvas. Left = “60” canvas . top : “100”>
<button. Effect>
<dropshoadow effect blurradius = “100” shadow depth = “100”>
</dropshadow effect>
</button. Effect>
</button>
</canvas>