Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

February 2009 - Posts

Was happy to see that Alex is back at MS.  Alex was a PM Lead during most of Avalon’s creation.  Now a dev lead in Sharepoint Grid…

Posted by Rob_Relyea | 1 comment(s)
Filed under:

Just ran into Brad Abram’s post on “Framework Design Guidelines- Serialization Technology”.  Interesting discussion.  Should we have a subsection for XAML in that section in the future?  What would you want it to say?

Posted by Rob_Relyea | 1 comment(s)
Filed under:

Sean McDirmid started this CodePlex project, and just released RC2 of Bling.  From http://bling.codeplex.com/:

Bling is a C#-based library for easily programming images, animations, interactions, and visualizations on Microsoft's WPF/.NET. Bling is oriented towards design technologists, i.e., designers who sometimes program, to aid in the rapid prototyping of rich UI design ideas. Students, artists, researchers, and hobbyists will also find Bling useful as a tool for quickly expressing ideas or visualizations. Bling's APIs and constructs are optimized for the fast programming of throw away code as opposed to the careful programming of production code.
Bling as the following features that aid in the rapid prototyping of rich UIs:

  • Declarative constraints that maintain dynamic relationships in the UI without the need for complex event handling. For example, button.Width = 100 - slider.Value causes button to shrink as the slider thumb is moved to the right, or grow as it is moved to the left. Constraints have many benefits: they allow rich custom layouts to be expressed with very little code, they are easy animate, and they support UIs with lots of dynamic behavior.
  • Simplified animation with one line of code. For example, button.Left.Animate.Duration(500).To = label.Right will cause button to move to the right of label in 500 milliseconds.
  • Pixel shader effects without the need to write HLSL code or boilerplate code! For example, canvas.CustomEffect = (input, uv) => new ColorBl(new Point3DBl(1,1,1) - input[uv].ScRGB, input[uv].ScA); defines and installs a pixel shader on a canvas that inverts the canvas's colors. Pixel shading in Bling takes advantage of your graphics card to create rich, pixel-level effects.
  • Support for multi-pass bitmap effects such as diffuse lighting.
  • An experimental UI physics engine for integrating physics into user interfaces! The physics supported by Bling is flexible, controllable, and easy to program.
  • A rich library of geometry routines; e.g., finding where two lines intersect, the base of a triangle, the area of triangle, or a point on Bezier curve. These routines are compatible with all of Bling's features; e.g., they can be used in express constraints, pixel shaders, or physical constraints. Bling also provides a rich API for manipulating angles in both degrees and radians.
  • And many smaller things; e.g., a frame-based background animation manager and slide presentation system.
  • As a lightweight wrapper around WPF, Bling code is completely compatible with conventional WPF code written in C#, XAML, or other .NET languages.

Bling is an open source project created by Sean McDirmid and friends to aid in design rapid prototyping. We used Bling to enhance our productivity and would like to share it with other WPF UI design prototypers.
Posted by Rob_Relyea | 1 comment(s)
Filed under:

As we always the love the two way discussion about WPF/XAML, the WPF team is excited about the upcoming MVP Summit and Mix09.

  • MVP Summit is by invitation only for Microsoft MVPs.
  • Mix09 is the Microsoft Web Conference.  Lots of Silverlight and WPF there!

@ MVP Summit, I’ll be giving a talk on XAML on Tuesday, 3/3.  It’ll be an evolution of our PDC09 talk on XAML.  I also plan on attending a Monday evening social gathering…  Hope to see you there (or meet you if we haven’t met yet).

@ Mix09, I’m not attending this year.  My team needs my total attention right now, so I can’t spare a week at Mix this year. Also, most of my focus right now is XAML, and I’m less focused on WPF overall, so there are better people to present on WPF issues. I’ll update this post later with pointers to the WPF sessions…  I’ll be watching many sessions from Redmond…

Posted by Rob_Relyea | with no comments
Filed under:

Dear XAML Nation:

My days, like many of you, are filled with work with XAML.  This space gets more exciting every year!  I wanted to do a brain dump of our current work items, plans, etc…  We first unveiled most of this information at our XAML talk at PDC 2008. If you haven’t seen that talk and you are hungry to understand much of the writing below, you should watch the video. We’re trying to be transparent with our progress with this complex set of components and scenarios.  I look forward to your questions/comments now, and when you get the first .NET 4 beta… 

Thanks, Rob

New XAML Engine for .NET 4System.Xaml

We are providing a unified, enhanced XAML engine for WPF, WCF, WF and more.  This unified XAML engine is System.Xaml.dll (planned to ship in .NET 4).

New XAML Language Features: XAML2009 - XAML2009

At PDC 2008, we discussed ~9 new XAML language features.  When .NET 4 Beta 1 ships, we’ll begin posting individual posts going into the different features.

XAML Reading

Our work to make WPF 4 use System.Xaml includes a new codebase for interpreting XAML files.  XamlXmlReader will ship in System.Xaml.dll v4.  Current users of XamlReader.Load() will automatically get the new engine doing the same work for them, but better.

BAML Reading

Our work to make WPF 4 use System.Xaml includes a new codebase for interpreting BAML files (a binary format).  Baml2006Reader will ship in PresentationFramework.dll v4.  Our focus here right now is compatibility and matching performance of BAML in v3.  BAML in general, at least for built in WPF types, avoids much of the reflection that XAML usually needs to go through.  Current calls to Application.LoadComponent() will automatically get the new engine doing the same work for them, but better.

  • FxCop: With .NET 4, FxCop rules that can analyze BAML will be possible to write. If appropriate for your scenario, using XamlXmlReader in FxCop would also allow you to write FxCop rules to analyze XAML (if you distribute this as part of this app) as well (without having to create the corresponding object graph.)

Localization – WPF (BAML)UI Localization

We have work under way to make the localization APIs that LocBaml relies on built on top of the System.Xaml infrastructure.  As we do that work, we are attempting to address several issues in this space.  We are unsure if this work will ship with .NET 4 or seperately.  In v3, it was provided by PresentationFramework.dll, but this API generally isn’t needed at runtime, so we are considering not making it part of the framework directly.

As more and more groups inside and outside of Microsoft are localizing more and more BAML, we are getting a very good idea of which problems we need to focus on first.

Localization – XAML (Silverlight, other)

The work I mention above in “Localization – WPF (BAML)” will benefit localization scenarios (x:Uid based) for XAML as well (not just BAML).  Systems that want to benefit from that should make sure to not crash if they see an “x:Uid” attribute.

Markup Compiler – WPF

We have a goal to completely rewrite the markup compiler, however it is very unlikely that will happen in .NET 4.  We likely provide an updated Markup Compiler in conjunction with good support from Cider and Blend for XAML2009 features.  Designers and compilers need to move in lock step, ideally.

BAML Writing

Since both Localization and the WPF Markup Compiler require Baml2006Writer, and since they both may not ship in the v4 box, we may not have Baml2006Writer baked enough to ship in the runtime in v4.  I still hope to, but it may not be feasible.  We’ll see.  I know many of you want this!

  • Obfuscation of BAML: once we provide the BamlWriter, we believe that obfuscation engines will be able to obfuscate type/member names in BAML.

XAML Writing

We have invested a lot of time and effort in XamlServices.Save() which uses XamlObjectReader and XamlXmlWriter under its covers.  If all goes well, we will be providing a number of enhancements for current uses of XamlWriter.Save().  We currently don’t plan to make your old calls to XamlWriter.Save() use the new XAML Writing engine in v4, but if XamlServices.Save provides value for you, you can call it.

Markup Compiler – Silverlight

My team builds the markup compiler that validates XAML and generated .g.cs/.g.vb code files in Silverlight projects.  We are doing some minor work in this space for SL3 and plan more major investments in releases beyond that.

XAML Language Spec - Specification

We are actually finally getting some customer issues on [MS-XAML] come in through our support channels.  Great to get these.  We plan on shipping a version updated with fixes for many of those issues and including the new XAML2009 features.

XAML VocabulariesXAML Vocabularies, Specification

WPF v4 – we are planning on shipping a draft of the WPF v4 XAML Vocabulary when Beta 1 ships.  This will be similar to [MS-WPFXV], with new stuff added in.

Other – inside Microsoft and around the world we continue to see more and more people use XAML for things other than UI, Workflows, Paper.  We’re always excited to see new uses for XAML!

I mistitled this post, and thus the URL was broken.  Fixed the year “2009”  :-) and reposted here: http://blogs.windowsclient.net/rob_relyea/archive/2009/02/26/xaml-state-of-the-union-feb-2009.aspx
Posted by Rob_Relyea

A WPF Search Text Box control that you may find use for, or learn from.  Thanks David Owens for sharing!

image26[1] 

(top line is “instant search” mode.  bottom line is “delayed search” mode.)
Posted by Rob_Relyea | 3 comment(s)
Filed under:

I don’t get a chance to try out many WPF Custom Controls, but I like to pass on pointers as I see new ones. Mindscape just released a Flow Diagram control for WPF.

JD announced it on his blog: http://blog.bluecog.co.nz/archives/2009/02/25/we-shipped-wpf-flow-diagrams/ 

He links to several screenshots, trial download, etc…

diagramscreen1[1]

Posted by Rob_Relyea | 1 comment(s)
Filed under:

More details about VS 2010 UI:

http://blogs.msdn.com/jasonz/archive/2009/02/20/a-new-look-for-visual-studio-2010.aspx

Posted by Rob_Relyea | 2 comment(s)
Filed under: ,

Events

WPF

WPF Apps

  • I notice that the percentage of apps that I’m running often that are .NET/WPF apps are ever increasing…vs2010, KaXaml, powershell_ise (in win7), Blend, blu. Beyond that:  LiveWriter is a .NET/WinForms app. Zune is a .NET/other app.  This is all good, because most Windows apps don’t need to load user/gdi because they are already loaded. Soon most WPF apps won’t need to load WPF assemblies because they’ll already be loaded by another app.

WPF & XAML

XAML

  • XAML Guidelines and Best Practices…post by Corey. (links to Jaime’s guidelines)

File Format Converter

Love seeing all the great things people do…

On blogs.WindowsClient.net, I saw a link to Andrej Tozon’s blog about the PhotoSuru install experience.  Read his post.  Try the install experience of PhotoSuru.

User experience is more than just the app runtime…it is the app lifecycle.

Posted by Rob_Relyea | 2 comment(s)

Scott Hanselman’s podcast contains 3 WPF/Silverlight related podcasts as of late:

I listen to mostly non-work related podcasts…but maybe that will change.  Just subscribed…

My experiences:

  • I’ve been using blu (originally called *chirp)…which got me tweeting a bit.
  • I’ve been using the VS text editor and working more closely recently with that team to make sure our XAML stack is working great for them.
  • I’ve never used Moonlight.
Posted by Rob_Relyea | with no comments

I worked with a part of the VS2010 team recently to improve XamlReader.Load performance for an important scenario.  It was taking 120ms to load a XAML file and create the objects that it specified.  It seemed like the XAML was a bit verbose, so I wrote a quick tool to analyze the types, properties and values used.  Digging in, I was able to see that many properties were set on every instance of that type, and usually to that same value.  That was a clue that the DefaultValueAttribute of many of the properties was not set appropriately.

A few days later, I heard of 2 improvements that helped perf of this scenario (measured in warm start scenarios, I believe):

  • moving to the System.Xaml.dll engine improved this scenario from 120ms to 72ms
  • fixing the default values, and thus loading a smaller XAML file, took it down from 72ms to 38ms

We will still try to help them reduce the time more, but we’re really happy with the progress so far.  It is also exciting to see VS adopting XAML in their UI and for several other scenarios as well.

We’re really happy of our current XAML to Object performance of the new XAML stack…we continue to profile many scenarios and figure out other ways to get more speed.  Our BAML to Object performance right now isn’t where we need it, so we are actually investing more optimization/profiling time there right now…

Getting the XAML Analysis Tool

The tool I wrote uses System.Xaml.dll, so I won’t ship it yet…but I’ll provide my little utility as it may help others understand how their XAML Vocabulary can be improved.

Love the control browser app that Mike Taulty put together!  Shows all of the built in, toolkit, and (most) 3rd party controls for WPF and Silverlight.  Great idea!

By clicking on the picture in his post, or this link directly to the click once app, you can have a great way to explore available controls.

Page view counter