Strange behavior with Silverlight when showing modal dialogs in SharePoint

Recently I have been working seriously on integrating Silverlight applications in SharePoint. I already have some experience with SharePoint but with my everyday work I discover more and more “features” of that system.

The Scenario

Everything started with a scenario I had to implement within SharePoint and ended up to be related just to Silverlight. So, my scenario involves creating a small Silverlight application, which is displayed within a web part. This application requires showing a modal dialog, which hosts another application. As my web part may be placed in small space, I preferred to use SharePoint’s dialog feature instead of using ChildWindow. Those two Silverlight applications (the one in the web part and the one in the dialog) communicate via local message infrastructure, which Silverlight provides. Continue Reading…

Integrating Google Analytics with Silverlight – Part 2

In my previous post I told you about how to track user activity in your Silverlight application using Google Analytics. The real communication is done through a framework, called Microsoft Silverlight Analytics Framework. I have to admit that this framework lets you integrate your application with whichever analytics service in seconds. However, you need to add a few assemblies to your project – a fact which you may not be that happy with. Here is the list of these assemblies and their approximate size:

  • System.Windows.Interactivity.dll ~36KB
  • System.ComponentModel.Composition.dll ~242KB
  • Microsoft.WebAnalytics.dll ~ 40KB
  • Microsoft.WebAnalytics.Behaviors.dll ~34KB
  • Google.WebAnalytics.dll ~ 23KB

Continue Reading…

Integrating Google Analytics with Silverlight

Silverlight has brought greater interaction and experience to web users. However, when it comes to SEO and web statistics, it is probably not the best solution. Imagine you need to track down what visitors do in your web site. You need to integrate a statistics framework into your web site. You can create your own or integrate an existing one. What are the advatages of using an existing analytics framework?

  • you just sign in for an account and start using it – simple and fast
  • you have an access to a wide range of statistics – graphical and textual

There are many analytics vendors. One of them is Google Analytics – the one I will use to demonstrate its integration into Silverlight in my post. Continue Reading…

Silverlight Client for Facebook

The Microsoft Silverlight 4 Beta Client for Facebook has been released as a developer preview sample. In order to use it you must have Silverlight 4 developer builds installed. There is a sample application which does the same things you can do when using Facebook web version. There are a lot of cool ways to explore your Facebook information. It supports some kind of Outlook integration – if you right-click on events that you may have to send an email and such.

You can download the application and try it yourself. It can also be intalled on Mac but only if Intel is inside. Enjoy! 🙂

Extending ItemsControl in WPF/Silverlight remark

Have you ever tried to extend ItemsControl in WPF/Silverlight? I guess the answer is Yes. In many situations you need to create a custom control, which support items. In this case you can use either ItemsControl or ListBox as a base. ItemsControl provides a couple of methods to help you build your items control. Such methods are IsItemItsOwnContainerOverride, GetContainerForItemOverride and PrepareContainerForItemOverride. When you add items to your control these methods are being called to help you manage your items. But have you run is such situation that when you added items these methods were not called? Well, it’s a very strange situation really. Here is you should make sure when you encounter this problem:

  • make sure you are extending ItemsControl
  • make sure your ItemsSource actually has items
  • make sure the control is visible
  • make sure you have put ItemsPresenter in the Template of your control

ItemsPresenter specifies where items should be placed, so always make sure you have placed it along other controls in the Template of your items control.