XamlPadSample – Step 1
XamlPadSample step 1 sample code is now available for download from http://robrelyea.com/demos/XamlPadSample/XamlPadSample-2010-01-20.zip.
It requires .NET 4 (although I’m not using Beta2, if you are still on Beta2, I think it will work. Please post questions/solutions on getting it to run on Beta2…)
Intro
Yesterday I blogged about “Exploring: XamlPad to XamlDesigner” and mentioned that I was going to post some sample code for a richer XamlPad that would take advantage of .NET 4 for new capabilities.
I’m not currently planning on making it easy to install my XamlPadSample binaries. I’d prefer to share the code, and see existing XAML Tools improve, and new ones develop where interesting. My team wants to help by providing XAML API infrastructure and samples to enable more productive uses of XAML.
XamlPadSample Step 1 – What is it?
Matches the basics of XamlPad v3
- Edit the XAML in a TextBox, as you type, see changes show up in the View pane. I’ve built a XamlPad usercontrol in XamlPadHelpers.dll.
Then adds a few more basics
- Supports Page or Window at root with Proxy object (since Page/Window classes can’t be hosted inside a standard WPF Window). I have the basics of this working, although real WindowProxy and PageProxy classes should be built…right now I’m just using a ContentControl.
- Strips Events – you can now have <Button Click=”foo” /> in XamlPad…and it won’t complain. This is implemented in XamlEngine.cs in a custom Xaml Node Loop.
- Strips x:Class – you can now have x:Class in XamlPad…and it won’t complain. This is implemented in XamlEngine.cs in a custom Xaml Node Loop.
Xaml for Config
- I’ve also built XamlPadConfig, UserSettings, XamlDocumentViewModel, and XamlDocument as CLR types that are both XAML Friendly and DataBinding aware. This effectively let’s me persist (in config.xaml) settings that include user preferences, and current user state (documents open, which view per document, etc…). I blogged about this earlier in “Persistable View Models & XAML for Config”. Most of this work is done in MainWindow.xaml.cs. Go look at config.xaml.
What’s Next
I plan to discuss (and or release samples) of the numerous other steps that I mentioned in the “Exploring: XamlPad to XamlDesigner” article.
Which of those steps are most important to you?
(I have most of them built already, however I’ve rewound, rebuilding from the ground up, and improving along the way)