Wednesday, December 06, 2006

Microsoft's WPF/E Released for Windows and Mac

Microsoft has released their new "Windows Presentation Foundation Everywere" beta plug-ins for Windows and Mac. Currently this is awkwardly shortented to WPF/E but this is just a codename and will be replaced soon. WPF/E is basically a graphic runtime to provide capabilities similar to Flash but with a MS centric approach to development. Most Flash developers will react with a "whatever" I think and I really don't see this as a "Flash killer" that some seemed to fear when the project was first announced.

The one place where it has a serious advantage is that it is built around MS development tools so if you are a .NET developer it will be a much more comfortable way to built a RIA frontend to .NET apps. Until now, if I wanted the build that kind of front end to some .NET code that needed rich graphic abilities the best approach would be to either use web services or remoting with a flash movie or use something like Zinc as a flash wrapper that allowed dll connections. This is where I think WPF/E will be the best fit, especially combined with new tools like Microsoft Expression. Expression is basically a MS take on Dreamweaver that is tightly integrated with building .NET front ends.

Another interesting part of WPF/E and the rest of this software stack is the use of XAML. I've been dealing with XAML for little while now through the .NET CMS Sitecore which uses XAML for it's admin interfaces. XAML is an XML language for describing user interfaces. Here's a small snippet to give you a taste of what it looks like.


   1:<Canvas x:Name="MyCanvas">
2: <TextBlock x:Name="MyText" Width="300"
Canvas.Left="15" Canvas.Top="15"
FontFamily="Helvetica" FontSize="14"
TextWrapping="Wrap">
3: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam et felis.
4: </TextBlock>
5:</Canvas>


So it looks more like Flex development that Flash development but with many of the details leveraged from Ajax and Javascript. Using XML for layout can really payoff on form based apps where the layout changes according to what controls are visible. The integration with the browser appears better at first glance than Flash with it being much easier to script back and forth between the pages DOM and the WPF/E app's DOM.

I haven't looked at the animation side of this at all but I suspect that Flash will ahead here for a long time. The animation is just more XML nodes which will be very strange to Flash animators. Of course, this will probably be hidden behind tools that have more timeline style interfaces and write the XAML animation code for you. Only time will tell if this approach can be as expressive as Flash's approach or whether it ends up being kind of just halfway there like Dreamweaver's javascript animation timeline.

Tuesday, December 05, 2006

Better CSS for ASP.NET 2.0 controls

ASP.NET controls have a weird tendency to write a lot of old fashioned HTML and Visual Studio tends to encourage styling on a control basis. The new Expression tools are better about making CSS style layouts so hopefully that will come to Visual Studio.

Until then, here are some Control Adapters to help some of the messier controls. The updated controls include GridView, DataList, DetailsView, FormView, Menu and Login.

Control adapters are part of a ASP.NET 2.0 extensibility layer that lets you change the rendering output of a control so you can write your own if there is something you need that isn't in this kit. The treeview for example, renders hidden and uses a lot of javascript to show expanded nodes. If you wanted to emphasise usability, you might want to reverse this to use javacript to hide hidden nodes so that a non-javascript client could still reach all the nodes.