Thanks for visiting my blog!
Url: http://wilderminds.blob.core.windows.net/downloads/ADOGuy.Web.Wpfe…
As some of you know I am writing an appendix about WPF/E for the new revision of Chris Sells/Ian Griffith’s Windows Presentation Foundation Book. While editing the appendix, Ian Griffiths noted that using agHost.js file seemed like a good temporary solution, but that there needed to be an ASP.NET control that was smarter. This has been on my mind for the last few weeks so I finally spent a sleepless night writing a first version. This first version took some ideas and code from Mike Harsh’s version found here.
For those of you who know how WPF/E SDK works, it uses a script called aghost.js file to emit the right tags (object tags for IE, and embed tags for firefox). I also had some other things I wanted from an ASP.NET Server Control. Here are the features I added:
- The right tags are emitted from data on the server. In other words if the Request is from an IE Browser, I only emit object tags. If it is FireFox, I emit embed. Same for Macintosh browsers.
- I wanted to be able to work with XAML files during development, but to reduce round-trips to the server, I wanted to be able to have the control embed the XAML in the page for me automatically.
- All the properties of the agHost JScript class to be exposed at the design-time.
- A full design-time experience allows resizing of the control, though actually showing the XAML in the designer is not supported.
- Design-time SmartTag is supported to help users pick crucial properties of the WPF/E host.
- To avoid a FireFox bug when using embedded XAML, I am testing the page for the XHTML DOCTYPE to alert the developer of the FireFox bug and how to fix it.
To use the control, you need to download the zip file and compile the project. I have not signed the control for simplicity. You can either add it to your toolbox manually, or simply add it to your project and add the control tags manually. You can see the tester website that is included in the zip file for an example of using the tag.
This is a 0.01 Release (very Alpha)! I spent the last six hours coding it so the XML comments are very rough and the tester only tests some obvious situations and I have not tested it under Mac’s FireFox or Safari browsers (anyone who can, please let me know). I expect as the release of WPF/E comes closer, I will either continue polishing this or a Microsoft ASP.NET control will take over its features. Either way, it should make developing WPF/E easier. Please let me know what you think and what you like and don’t like!
If you have bugs, please e-mail me at shawn@wildermuth.com and please include what version of Visual Studio you’re using (only 2005 is supported right now, but if you have the Service Pack installed for VS and what add-ons like the VS Add-ons for WPF, WCF, etc.). Also what operating system your developing on, and what operating system your are deploying on.
UPDATE: I’ve found a couple of bugs, most glaring is that the “Click to Activate” bug on IE. It seems that if you construct the object tag, it has to be in script external to the page to avoid that problem. I still am not happy with the solution, but i’ll let you know what I come up with.