Feed Icon  


  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics


Open Source Projects



WPF/E Server Controls

Posted in ASP.Net/Web Services | WPF/E at Monday, March 12, 2007 5:02 PM Pacific Standard Time

Donald Burnett has an interesting piece call Poor, maligned, and misunderstood by many: WPF/E which I found to be an interesting read. He brings up two myths about WPF/E that (1) it doesn't support databinding and (2) it doesn't have any input controls. I think I've personally contributed to dispelling the first myth here and here but I haven't spent much time on the second one. I've spent a lot of time thinking about it and I've written about it in the WPF/E forums but haven't done anything beyond that.

Then today I read Martin Grayson's updated tutorial on creating glassy buttons in WPF.

picture of the glass buttons app runing

I thought the buttons looked pretty cool and so I set out to create them in WPF/E. I decided to code them up as a server control instead of just writing plain old xaml. You can view the end result of my work here:

 I wrote the code to create the server code once and now I just use an ASP.Net page to generate my Xaml. The ASPX page is very simple and looks like this:

<%@ Page Language="C#" CodeFile="Buttons.aspx.cs" Inherits="Buttons" %>
<%@ Register Assembly="Wpfe.Controls" Namespace="Wpfe.Controls" TagPrefix="cc1" %>
<Canvas xmlns='http://schemas.microsoft.com/client/2007'
Width="800" Height="600">
<cc1:GlassButton ID="GlassButton1" MouseLeftButtonDown="javascript:click" Left="200" Top="200" Width="179" Height="34" Text="My First Button" runat="server"/>
<cc1:GlassButton ID="GlassButton2" MouseLeftButtonDown="javascript:click" Left="200" Top="300" Width="179" Height="34" Text="My Second Button" runat="server"/>
<cc1:GlassButton ID="GlassButton3" MouseLeftButtonDown="javascript:click" Left="200" Top="400" Width="179" Height="34" Text="My Third Button" runat="server"/>
<ImageBrush ImageSource="Aero_grass.jpg" />

To create the button controls I simple followed Martin's tutorial using notepad and created the WPF/E xaml. Then I wrote a server control that output the Xaml and added properties to allow the output to be formatted the way I wanted. The link to the source is below if you're interested, but really this is just a proof of concept. I think there is so much more that could be done in this area and this is just scratching the surface.

What controls would you like to see? I'm thinking a basic button, textbox, dropdown, radio, and checkbox controls would be nice to have and probably not to difficult to create. I'm hoping to finish up Part 3 of my WPF/E data grids series using a WPF/E data grid server control. Anyone interested in starting a codeplex project?

Source Code Download

Tuesday, March 27, 2007 8:00:07 PM (Pacific Standard Time, UTC-08:00)
Great idea (I start simillar project but for Compact Framework and own parser/viewer)...
Thursday, March 29, 2007 7:16:54 AM (Pacific Standard Time, UTC-08:00)
Using server controls to emit XAML is indeed a sweet technique, especially in deploying re-usable UI components. I love that agHosts accepts a Page object just like that.

If you navigate to http://controls.wpfedev.com/Buttons.aspx
it's just pure XAML. Emitted solely with the HtmlTextWriter. Powerful stuff.

But for me I still prefer using AJAX and scripting any WPF/e behavior in the client code. Forms authentication input controls, for example, work great in AJAX and WPF/e. And I'll cop to it, I like writing XAML, and using Expression.

So who knows what WPF/e will look like in its release incarnation? Probably best to sit tight before starting any major endeavors such as building a control kit. But if you do start a project, I'll definitely be checking it out!
Monday, April 2, 2007 1:18:48 AM (Pacific Daylight Time, UTC-07:00)
Actually! This is a great idea. If you start a CodePlex project I'd be interested with helping you out.

Have you looking into Control Adapters? I am not too entirely familiar with them (yet), but from what I understand they could be used to emit XAML instead of HTML... That way you could stick to using regular ASP.NET markup but the rendering would be taken care of by the control adapters (no need for proprietary controls!).
Tuesday, April 3, 2007 10:21:40 PM (Pacific Daylight Time, UTC-07:00)

I work for Transcontinental and I am trying to convince my boss that writing our variable printing on demand web app would benefit from WPF/E instead of Flash.

Is WPF/E more secure than Flash, and how so?

thank you :)

Monday, April 9, 2007 8:18:28 PM (Pacific Daylight Time, UTC-07:00)
If you start something on codeplex I'll be interrested as well.

Just let me know.

Wednesday, April 25, 2007 5:45:57 AM (Pacific Daylight Time, UTC-07:00)

I've got a question about the animations you've introduced in the buttons (that fire when the mouse is over and out of the 2nd rectangle): why didn't you add 2 event triggers (one for mouseenter and another for mouseleave), each having a specific storyboard for entering and leaving? wouldn't this automatically play the animation?
Comments are closed.