XamlPadSample Step 1e-App.xaml and Assemblies
Added support to store which projects each XAML file is associated with, along with app.xaml and assembly reference info. Notice that I’m using XAML2009 support for Name references in XAML. I’m able to define object graphs (not just trees) via this mechanism.
Now that we have the info from the project; next, I’ll likely wire {StaticResource foo} to look in App.xaml when needed. And perhaps we’ll try loading some of these assemblies as well.
- <XamlPadConfig ActiveXamlDocument="3" WindowHeight="753" WindowLeft="0" WindowTop="0" WindowWidth="927" xmlns="clr-namespace:XamlPadHelpers;assembly=XamlPadHelpers" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <XamlPadConfig.Documents>
- <XamlDocumentViewModel BottomRowHeight="*" TopRowHeight="2*" XamlViewState="Xaml">
- <XamlDocument FileName="C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\App.xaml" Project="__ReferenceID0" />
- </XamlDocumentViewModel>
- <XamlDocumentViewModel BottomRowHeight="*" TopRowHeight="2*">
- <XamlDocument FileName="C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\MainWindow.xaml" Project="__ReferenceID0" />
- </XamlDocumentViewModel>
- <XamlDocumentViewModel BottomRowHeight="808.013333333333*" TopRowHeight="296.026666666667*">
- <XamlDocument FileName="C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\PromptForClose.xaml" Project="__ReferenceID0" />
- </XamlDocumentViewModel>
- <XamlDocumentViewModel BottomRowHeight="788.013333333334*" TopRowHeight="316.026666666666*">
- <XamlDocument FileName="C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\SettingsWindow.xaml" Project="__ReferenceID0" />
- </XamlDocumentViewModel>
- </XamlPadConfig.Documents>
- <XamlPadConfig.Projects>
- <ProjectData x:Name="__ReferenceID0" ApplicationDefinition="App.xaml" FileName="C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\Pad.csproj" LocalAssembly="__ReferenceID1" TargetFrameworkIdentifier=".NETFramework">
- <ProjectData.AssemblyReferences>
- <AssemblyData>C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\XamlPadHelpers\obj\Debug\XamlPadHelpers.dll</AssemblyData>
- <AssemblyData x:Name="__ReferenceID1">C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Pad\Pad\obj\x86\Debug\Pad.exe</AssemblyData>
- </ProjectData.AssemblyReferences>
- </ProjectData>
- </XamlPadConfig.Projects>
- <UserSettings EditorFontFamily="Consolas" EditorFontSize="16">
- <UserSettings.SelectionBrush>
- <av:SolidColorBrush Color="#FFFFFF00" Opacity="0.75" RelativeTransform="Identity" Transform="Identity" />
- </UserSettings.SelectionBrush>
- </UserSettings>
- </XamlPadConfig>
[overview of project: XamlPadSample page –today’s source snapshot: 2010-01-25 Source Snapshot]
Details from Backlog.txt in Pad Project:
---------------------------------------------
2010/01/25 - posted v1e - App.xaml & Assemblies
---------------------------------------------
Implemented: support to store which projects each XAML file is associated with, along with app.xaml and assembly reference info.
XamlPadHelpers project
•AssemblyData.cs
◦Created this type to store the fullpath to an assembly. (it was a string first, but NameReferenceConverter on a string property didn't work like magic, so I worked around with a new type.)
◦TODO: future improvement?
•ProjectData.cs
◦Renamed "Project" class to "ProjectData" as the name conflicts with some MsBuild types, etc...
◦Added support to find ApplicationDefinition XAML file, assembly fullpaths, TargetFrameworkIdentifier, etc...
•XamlDocument.cs
◦Created a ctor that takes a XamlDocumentViewModel
◦Made the Project property be a "NameReference" property via the NameReferenceConverter.
◦Created a FindOrCreateProject() method which will find the appropriate ProjectData object or create one.
◦Created a FindProjectFile() routine which does the probing that I mentioned in v1d.
•XamlPadConfig.cs
◦Added a collection of Projects
Pad project (formerly called XamlPadSample)
•MainWindow.xaml
◦Changed title to "Pad" from "XamlPadSample"
•MainWindow.xaml.cs
◦Changed config file from "config.xaml" to "Pad.config.xaml" (pattern is appname.config.xaml for now).
◦Rewired creation of default document objects to allow backpointers from XamlDocument to XamlDocumentViewModel
◦CloseDocument() will now harvest any orphaned "ProjectDatas"