April 2010 - Posts

Override Silverlight Existing Control

I’m on my way to Override the Template of Existing Control.

Like i want to override the Validation Error ToolTip, validation Summary Header Structure.

Apparently is not as hard as we might think.


Put on your User Control Resource.


  • Change the Style Target Type to your Control With NameSpace or with out it.

ex: Textbox or MyInput.textbox.


  • Modified this Template ,and control template as your need


  • Set x:name on the Style.ex:MyNewStyleName
  • On your control set the Style={StaticResources MyNewStyleName}
Share this post: | | | |
Posted by cipto with no comments

Silverlight Add Service Reference, Reference.cs Empty

It’s a bit tricky to add Service Reference on Silverlight. Since silverlight only support 2 methods like basic httpbinding and the other one.

So It’s different on how to do it.

You’ll Encounter why It’s always Failed and Empty on Reference.cs is you add From the Project –> add service reference.

In order to work Around this.

  1. Make sure on Your Web Service application has at least 1 Binding, Either BasicHttpBinding or the other one.Remember that If we add SVC, it won’t directly run as old asmx. so there has to be endpoint on the web.config
  2. On your BasicHttpBinding and Mex endpoint make sure the Contract is referring to your Interface
  3. Generate Proxy Always Using SLSvcUtil.exe it is design special for silverlight ,so if you use svcutil it will result differently.Output the file Somewhere, lets say called it :myreference.cs. it will output myreference.cs and the client.config
  4. Add Myreference.cs and client.config to you Silverlight Project, change the Namespace Correctly
  5. Delete the reference.cs on ServiceReference->yourServicereference
  6. If you have multiple Configuration for 1 service, you have to input the configuration Name From the config

Ex: MyServiceclient=new MyServiclient(“The Name”);

SLSvcUtil is shipped with SIlverlight 3,

so it’s on programfiles\microsoft SDKs\silverlight\3.0\Tools\

Test your service using wcftestclient to see if it's running or not


Share this post: | | | |
Posted by cipto with no comments

How to make 2 Div Same Height On IE and FF , Javascript

I’ve got a Scenario. Where if  a div changed on height , the other has to follow the same height.

Now on Mozzilla the Resize will not work. because there isn’t any Property/Event for this, I've tried Watch Property but does not run.

although DOMAttrModified will be called when an attribute changed, but that’s what i need.

on IE :


$('#Element1').bind("resize", function() {


if($.browser.mozilla) {
$("#Element1").bind("DOMAttrModified", element1Changed);

function element1Changed()
Share this post: | | | |
Posted by cipto with no comments

Embed Silverlight Via Javascript

If you experiences that firefox 3.5 does not load your silverlight,While when you check online the silverlight add on/plugin is already there  .

Then it's Time to embed using javascript. this works Like SWFObject.

Upgrade your Silverlight.js to the latest one, currently version 3.

than use the createObject method on document ready

More Detail 


Property Param Detail

Other than this there are Silverlight.supportedAgent.js which have a method to call wheter this browser is supported or not

Share this post: | | | |
Posted by cipto with 1 comment(s)

Silverlight 3 Bugs

  • When you click Resx, and press Save the constructor will always become internal , you'll get Xaml bad parse error on runtime, Solution, manually edit it to public
  • When There is no ClientAccessPolicy.xml on root will return 404
  • When Excedded Size of WCF configuration 404
  • When You don't enable Custom Fault, and override the benhaviour. everything from service error will be 500 and you can't see the inneException.
  • If you get 404, there could be a couple of things, one of them your object can't be serialize, linqtosql dbml have to set the serializationmode=bidirectional.

Share this post: | | | |
Posted by cipto with 1 comment(s)