Bryant Likes's Blog

It's all about WebData

Recent Posts

Tags

News


  • Windows Live Alerts
    View Bryant Likes's profile on LinkedIn

    Me

    Get Microsoft Silverlight
    by clicking "Install Microsoft Silverlight" you accept the
    Silverlight license agreement


    The posts on this weblog are provided "as is" with no warranties and confer no rights. The opinions expressed herin are the personal opinions of the individual authors and do not represent the views of Avanade in any way.

Community

Email Notifications

Archives

WPF/E Server Controls

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'
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800" Height="600">
<cc1:GlassButton ID="GlassButton1" MouseLeftButtonDown="BLOCKED SCRIPTclick" Left="200" Top="200" Width="179" Height="34" Text="My First Button" runat="server"/>
<cc1:GlassButton ID="GlassButton2" MouseLeftButtonDown="BLOCKED SCRIPTclick" Left="200" Top="300" Width="179" Height="34" Text="My Second Button" runat="server"/>
<cc1:GlassButton ID="GlassButton3" MouseLeftButtonDown="BLOCKED SCRIPTclick" Left="200" Top="400" Width="179" Height="34" Text="My Third Button" runat="server"/>
<Canvas.Background>
<ImageBrush ImageSource="Aero_grass.jpg" />
</Canvas.Background>
</Canvas>

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

Comments

Mike Harsh's Blog said:

Bryant has an interesting post about using ASP.NET server controls to project WPF/E XAML instead of HTML

# March 27, 2007 8:23 AM

Mike Taulty's Blog said:

Via Mike Harsh I came across this post (from Bryant) on using ASP.NET server controls to generate...

# March 27, 2007 1:48 PM

Mateusz Kierepka said:

Great idea (I start simillar project but for Compact Framework and own parser/viewer)...

# March 28, 2007 4:00 AM

l00p3r said:

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!

# March 29, 2007 3:16 PM

Mike-E said:

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!).

# April 2, 2007 8:18 AM

Antoine Dubuc said:

Hi!

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 :)

Antoine

antoine.dubuc@transcontinental.ca

# April 4, 2007 5:21 AM

OzFab said:

If you start something on codeplex I'll be interrested as well.

Just let me know.

OzFab

# April 10, 2007 3:18 AM

Luis Abreu said:

Hello.

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?

# April 25, 2007 12:45 PM

LA.NET [EN] said:

I decided spending 1 or 2 hours looking at how we could build and encapsulate controls with Silverlight

# April 29, 2007 3:03 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)