Title: programmatically launch sketchflow player
Tags: silverlight;sketchflow
Question: I am trying to embed a SketchFlow prototype in a PRISM region, i am successful in getting the sketchflow player visuals to render but it appears that the Sketch.Flow data is not loaded. I see a number of binding exceptions on the NavigationViewModel.
I know it may not be officially supported but I would like to host multiple sketchflows within a single Silverlight application so I can easily deploy new SketchFlow XAPs and display whichever one I so choose.


Here is another answer: The first step is to construct an instance of the PlayerWindow.
string targetTypeName = "Microsoft.Expression.Prototyping.Workspace.PlayerWindow, Microsoft.Expression.Prototyping.Runtime, Version=151.154.11.224, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
var targetType = Type.GetType(targetTypeName);
var view = container.Resolve(targetType) as PlayerWindow;
Simply constructing a PlayerWindow is not enough. The player window has code inside of it that unfortunately uses the CallingAssembly to locate the Sketch.Flow content and de-serialize it. Below I have modified the code I found in the Microsoft PlayerWindow class to do this to use a specified assembly instead of the one derrived from the CallingAssembly.
string str = string.Format(CultureInfo.InvariantCulture, "/SilverlightPrototype1.Screens;Component/Sketch.Flow", new object[] { PlayerContext.Instance.LibraryName });
StreamResourceInfo resourceStream = Application.GetResourceStream(new Uri(str, UriKind.RelativeOrAbsolute));
if (resourceStream != null)
data = Serializer.Deserialize(resourceStream.Stream);
Once I get the deserialized Sketch.Flow content back I think I need to re-initialize the PlayerWindow's NavigationViewModel using that data and the other view models, MiniFlowGraphViewModel, AnnotationViewModel, BrandingModel, as well as update DesignTimeAnnotations.
PlayerContext.Instance.RuntimeData = data;
view.NavigationViewModel = new NavigationViewModel(data);
view.MiniFlowGraphViewModel = new FlowGraphViewModel();
view.AnnotationViewModel = new AnnotationViewModel(view.NavigationViewModel, data.RuntimeOptions.DisableInking, data.RuntimeOptions.HideDesignTimeAnnotations);
view.BrandingModel = new BrandingModel(data);
PlayerContext.Instance.BrandingModel = new BrandingModel(data);
Unfortunately it appears that the DesignTimeAnnotations property on PLayerWindow is either internal or private so I am not sure how I can update it.
Doing the above will get me a SketchFlow Player inside of the region with the navigation display showing that I am currently on "Screen 1". However, the main screen display area is blank and the left hand control panels are not working. I get a variety of BindingExpression errors on NavigationViewModel, BrandinModel and FlowGraphModel.
DockedControls
CollapsedControls
SharedInkStrokes
InkVisibility
InkEditingMode
IsInkEditModeNone
IsMapOpen
IsFlowOverviewOpen

Here is another answer: There isn't quite enough info provided in your question to know for sure, but I suspect it has to do with how the SketchFlow Player finds the Sketch.Flow data file.
If you look at how a regular SketchFlow project is structured, you have a main app, and a second assembly containing the screens for the project. In the app.xaml.cs file of the main app, there is a line that looks like this:
[assembly: Microsoft.Expression.Prototyping.Services.SketchFlowLibraries("SilverlightPrototype1.Screens")]
That line defines where the SketchFlow Player will look for the data it expects. I haven't tried what you are doing, but that attribute will probably need to be set on your main, or the loading assembly that hosts the SketchFlow Player.
Please note that this is not officially supported in any way, I'm just trying to help find a solution for you.
Comment for this answer: See my attempted answer below...I provide a lot more detail about how I am trying to load the SketchFlow Player in the region. I think I am pretty close, but am probably missing some of the internal work that the ViewModels or the PlayerContext is doing.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2010:00:11/26/10', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<silverlight><sketchflow>', 'Title': 'programmatically launch sketchflow player', 'ViewCount': 300, 'id': 4288455, 'user_AboutMe': '<p>Follow me on Twitter!\n<p>\nRead my blog\n<p></p>\n', 'user_AccountId': 29488.0, 'user_DisplayName': 'markti', 'user_Reputation': 2783.0, 'user_Views': 476.0, 'user_id': 79749.0}}