Welcome to WindowsClient.net | My Blog | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Matthew Johnson: VS2010 and Windows Management…including XAML use

Happy to see more great detail from the VS team about how they have used WPF and XAML in the building of VS2010.

Matthew writes in great detail about the windowing system with: “WPF in VS 2010 – Part 5: Window Management”. As part of that, he details that the Windows state data is saved to XAML. VS ended up writing what you could call a specialized implementation of XamlServices.Load() and .Save(). They did this work before .NET 4 beta2’s work in XamlSchemaContext subclassibility work.

If this work was to be redone, it would be an option to use XamlServices.Load() and .Save() with a custom XamlSchemaContext that would avoid reflection…similar to the way that our XamlReader.GetWpfSchemaContext() implements.

Other vocabularies

There are other formats (XAML Vocabularies) that .NET 4 or VS 2010 have introduced, which we’ll get into more detail over time: VS MEF Catalog, msbuild properties, window management location, WF, WCF, and of course WPF.

Published Wednesday, March 24, 2010 3:02 PM by Rob_Relyea

Comments

# re: Matthew Johnson: VS2010 and Windows Management…including XAML use@ Thursday, March 25, 2010 12:42 AM

Hi Rob,

I am working on a content based UI project in WPF, I am using DataTemplates to define the visual part of the UI widgets that are composable. But right now I am using XML to represent the configuration definition of it. I am experimenting to use XAML for configuration. And the above mentioned article about VS2010 briefly says that they had to come up with a custom serializer generator because the generic xaml deserializer is slow.

Is that the case with xaml2009 improvements in .net4? How does it compare with the use of a custom serializer generator?

We have to load these config files in startup path, so perf is a critical thing.

Please share your insight.

Thanks

by George

# re: Matthew Johnson: VS2010 and Windows Management…including XAML use@ Friday, March 26, 2010 10:52 AM

George-

The Window Management data load and save time is especially performance critical. Every time you start or stop debugging or go fullscreen, it needs to write state and load new state. As such, they profiled it, and found that they could eek out a bit more performance with a bunch of custom code.

I suggest you profile your use of XAML, and consider addressing it, if you see it taking a significant amount of time.

There are optimizations that you can do, within the XAML stack or beyond.

As I mentioned in this article, what WPF does is build a custom XamlSchemaContext which provides XamlTypes and XamlMembers which have hard coded type and member data, so reflecion doesn't need to be used to determine XAML Schema...or for object graph creation. Go dig into the implementation of XamlReader.GetWpfSchemaContext() and releated.

Hope that helps.

Thanks, Rob

# re: Matthew Johnson: VS2010 and Windows Management…including XAML use@ Wednesday, April 14, 2010 2:51 PM

Thank a lot for the response. Yes I understand that a custom xaml schema context is the way to go. I have started some prototyping along that line already. I am planning to put a WPF Data templates itself into the xaml as one of the properties, which can be used for display purposes. But when I "Load" it using xamlServices it throws and exception: 'Set property 'System.Windows.FrameworkTemplate.VisualTree' threw an exception' Should I use the wpf deserializer instead of xamlServices to get the data template property hydrated using the wpf-xaml inside xaml2009. I understand I can use the node loop/stream or XamlDom in the tools to do it differently. But thoughts would be appreciated. I can post this in XAML forum so that others can chime in as well. Thanks, -George

by George

# re: Matthew Johnson: VS2010 and Windows Management…including XAML use@ Wednesday, April 14, 2010 3:18 PM

I fixed it. Thanks.

by George

Leave a Comment

(required) 
(required) 
(optional)
(required)