XamlPadSample Step 1g-Silverlight support
I coded this last step a bit over a month ago, and I’ve just not had time to share it out. Yesterday, I reviewed the deltas from the Jan. 30th version I posted. They are summarized below.
The major work I added was the ability to show Silverlight 4 projects in XamlPad, in addition to WPF 4.
Several open issues as well, but I can clean up more next time, right?
http://robrelyea.com/demos/xamlPadSample links to source code download and the other XamlPadSample posts.
Changes in 2010-04-19 Version
Pad Project
MainWindow.xaml
- Set Window.AllowDrop to true
MainWindow.xaml.cs
- Added DragDrop event support to open files via DragDrop
XamlPadHelpers Project
AssemblyData.cs
- Don't attempt Assembly.LoadFile() if the file doesn't exist. This would happen if you used a XAML file from a project that hasn't been built.
ProjectData.cs
- Added an AssemblyResolve event handler, to better load assemblies. Look in loaded assemblies, if match, use that one.
- GetFileInfoFromRelativePath - support absolute paths in relativePath parameter
- Add empty else clause in case hintPath is ever null or empty.
View.cs
- Change property Type of type Type to be TypeFullName of type String.
XamlDocument.cs
- TODO - Why is xamlPadConfig ever null in FindOrCreateProject
XamlEngine.cs
- Added TransformXamlDocumentToRuntimeReadyString() - Does XAML to XAML filtering (removes events, x:Class, etc..)
- Changed LoadXamlDocument to create its own XamlObjectWriter to pass into XamlEngine.Transform
- Changed LoadXamlDocumentWithAppResources to create its own XamlObjectWriter to pass into XamlEngine.Transform
- Renamed LoadObjectsForDesign to Transform()
- stopped creating XamlObjectWriter, instead rely on call to create XamlObjectWriter or XamlXmlWriter and pass it in.
- xml:Base - if Silverlight project, only let one through
- Return null, require caller to harvest result out of XamlObjectWriter, etc…
- Changed WriteResourceProxyPreamble, WriteMemberValue, and WriteResourceProxyPostamble to use XamlWriter, instead of only XamlObjectWriter.
XamlPad.xaml
- Using non-attached *ScrollbarVisibility instead of attached versions (no effective change in behavior)
XamlPad.xaml.cs
- OnPropertyChanged() - In the silverlight project case, use SilverlightView to display content
- Note - which silverlight DLLs can be loaded is a bit of a hack now.
- TODO: use the SilverlightSchemaContext from XamlToolKit
- Loading themes\generic.xaml for default datatemplate for an object per referenced blog post
SilverlightView Project
- Silverlight 4 project which gets requests to load XamlString from host.