Is SMF compliant with WPF application

Apr 29, 2010 at 9:58 AM

Hi all,

I would like to know if the framework is compliant with WPF application?

thnks for your help

Apr 29, 2010 at 3:21 PM

The answer is yes. You just need to use a third party application like Desklighter ( to embedd your xap file into a exe file.

Apr 29, 2010 at 3:46 PM

Interesting, never heard of that utility.

I would just go and make a out of browser Silverlight app instead. I guess it depends on what WPF has that you need.

Silverlight 4 does now support installing an out of the browser app via an installation instead of from the browser.

Apr 29, 2010 at 4:02 PM
Hi DarthObiwan, The purpose is to make an online video player (which is done) and use it into a standalone application also (with no installation). Desklighter fit perfectly my needs. the only issue which still remains is that the framework seems not to handle "internal" URL for the video (I mean, the video is embeded as Resource into a dll into the xap file) for a complete "out of web" mode. Using MyAppNamecomponent/video/myvideo.wmv seems not working with as source since it causes a System.InvalidOperationException (maybe I'm somewhere wrong with the way I'm doing it). Just to be sure (andd not waste my time on that) : is it possible to use the framework to view "offline" video located as resource into the project?
Apr 29, 2010 at 5:16 PM

Yeah there are some differences in WPF and Silverlight for internal resources.

I'm not sure about what SMF can do for playing the video. SMF is a wrapper for the SmoothStreamingMediaElement which is a wrapper for MediaElement. If it works with mediaelement it should work with SMF. I've never tried pointing to a video within a DLL. I'd probably try pointing it to content within the xap, that allows you to do just a relative uri. Still not knowing exactly what desklighter does, it may be something that it is getting in the way of.

Apr 29, 2010 at 5:25 PM
Edited Apr 29, 2010 at 5:26 PM

SMF is handling local resources :)


Here is the solution, considering you have set a wmv file as Resource in the "build Action" property field :

In the main page


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.IO;
using Microsoft.SilverlightMediaFramework;

namespace MySlApp
    public partial class MainPage : UserControl
        public MainPage()
            CoreSSM.Loaded += new RoutedEventHandler(CoreSSM_Loaded);
            thePlayer.MediaElement.EnableGPUAcceleration = true;

        void CoreSSM_Loaded(object sender, RoutedEventArgs e)
            StreamResourceInfo sr = Application.GetResourceStream(new Uri("MySlApp;component/myvideo.wmv", UriKind.Relative));
            CoreSSM.AutoPlay = Convert.ToBoolean("false");


Instead of using an absolute URL/URI to populate the source, we could use the SetSource() function and "parse" our local video into a stream object. You must do that because the .Source is not able to manage the relative paths

Doing that, you have an xap file which embed the video into a dll. Then, you can use this xap ackage with Desklighter for building very easily a desktop video player displaying an embeded video.