New Changes

Just added a MVVM pattern. Demo can be switched between UserControl and MVVM mode by using the startPage WebPart property. Use 'mvvm' for MVVM demo and 'uc' for UserControl demo:

Project Description
This is a project template containing a number of base classes and JavaScript which allows SharePoint 2010 Silverlight web parts to communicate with each other inside the browser. It provides Silverlight web parts with the functionality normal web parts get from interfaces.

http://geoffwebbercross.blogspot.com/2011/02/sharepoint-2010-silverlight-web-part.html

Overview
This template contains base classes and scripts enabling Silverlight web parts (and ASP.Net web parts) to be created enabling client-side interaction with other Silverlight Web Parts. A JavaScript file is injected into the page automatically and allows Web Parts to register themselves for interaction with the bridge. If only Silverlight to Silverlight communication is required, local messaging could be used as an alternative mechanism, however this technique allows interaction from both Silverlight and ASP.Net web parts which is more flexible for SharePoint applications.  A Web Part using the base classes has the following properties required for JS Bridge connection:

* JSClientID - Used to pass the JavaScript Bridge ClientID from the SharePoint UI to the Web Part. JSClientID is a simple identifier for components connecting to the JS Bridge.

* JSClientSourceID - Used to pass the JavaScript Bridge ClientSourceID from the SharePoint UI to the Web Part. JSClientSourceID indicates to the JS Bridge where a components connection is sourced.

* JSUniqueClientID - JSClientSourceID indicates to the JS Bridge the real ID of the component on the page. It is derived from the WebParts’s ClientID with an ‘SL’ suffix.

Registering Clients
When a client Web Part loads, it registers itself with the JS Bridge using the registerClient method, this allows the bridge to locate the Web Part on the page and lets it know where to route data.

Writing to JS Bridge
When a client WebPart wants to send something, it calls the JS Bridge using the JSBridgeWrite method, which looks at the ClientID and multicasts the data to any WebPart with a corresponding ClientSourceID.

Last edited Apr 23, 2011 at 10:15 AM by geoff_cross, version 13