Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here

In my last blog post (WPF, Family, Rowing in Feb 2011), I said:

Haven’t been blogging much lately, but you can see a lot of me on Twitter: http://twitter.com/rrelyea

Lots has happened since February...and I'm changing blog sites.

Read on...

Rob's Blogging History

An updated history of my blogging sites:

Yes, my blogging history has been a bit twisted - see "Never change your blog address - oops"

So What Now?

So now my plan is to move all my blogging to the wordpress site...so I'm kind of going back to my 2nd blog - http://robrelyea.wordpress.com

In fact, I just blogged my first new post there with the big news you would have seen on twitter: My shift from WPF-XAML to Kinect for Windows

 

Posted by Rob_Relyea | with no comments
Filed under: ,

<WPF MoreFunStuffComing=”true” />

Haven’t been blogging much lately, but you can see a lot of me on Twitter: http://twitter.com/rrelyea

I’m focusing 90% of my time on WPF vNext right now – having lots of fun working on it.

WPF team has a blog, but we’ve really only talked about WPF Ribbon in the last few months. Look for more coming up…

<Family LotsGoingOn=”true” />

Both of my kids are busy this winter playing Basketball. I’m assistant coaching my older son’s team. Having fun doing that.

After I had a milestone birthday last year, my wife is next…have some fun things planned.

<Rowing NewSeason=”true” />

Today we got back on the water for the first time this spring. Our team has a stronger (and deeper) team this spring than we did last year. Should be a fun season!

 

Hope all is well with you all!

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

Mike Shim blogged how you should Use XamlReader.Load for WPF XAML (not XamlServices.Load).

I just saw a twitter comment asking how to XamlXmlReaderSettings with XamlReader.

I believe we ended up enabling in .NET 4, the ability to use System.Xaml.dll with WPF with a few special exposed APIs:

//If you want to set any special settings (like local assembly, you can set those settings here)
XamlXmlReaderSettings xxrs = new XamlXmlReaderSettings() { };
//The WPF Schema Context is optimized for perf.
XamlXmlReader xxr = new XamlXmlReader(@"c:\temp\rtf.xaml", System.Windows.Markup.XamlReader.GetWpfSchemaContext(), xxrs);
//Calling this API will ensure that any special operations for WPF are done on this XAML node stream.
object root = System.Windows.Markup.XamlReader.Load(xxr);

Believe that will work…my memory and quick test says that it does work. Please comment if I am mistaken.

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

Just tripped on a blog post from a Microsoft F# team member where he says:

“I finally deeply understand XAML, and I really now grok and appreciate the WPF architecture and all the terrific-looking UI you can easily create in a small amount of XAML or code”

Beyond liking to read that kind of quote…I’m excited to see continued increasing exposure and interest of XAML UI by folks across the VS ecosystem (including the VS team). He’s been working on a WP7 app, and reading a WPF book.  All good to see.

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

This fall, an opportunity that I wasn’t expecting popped up. My rowing team had a Masters Men 4+ slot in the Head of the Charles Regatta this fall, and due to injuries/etc… none of the 4 people from last years boat would be able to make it this year.

I tried out for the boat, and last week found out that I made it!

The next 5.5 weeks will involve about double the amount of training I’m used to, but I’m very excited to be going to Boston for this huge race. I’ve only rowed in it once, in 1990, when I was 20. Now, I’m 40, and in it again.

Excited!

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

I’ve run into 2 situations the past few days that have called out the need for enabling people to more easily do what you are asking.

1) Rowing team asked people to go pay for the fall season. Would be great to include the URL to go directly to the payment page.

2) State of Washington sent out postcards to all people with crab licenses this year and asked them to go to “https:fishunt.dfw.wa.gov”.  Fail! 

Eventually, I found the right link:

image

Clicking on that brought me to a page with the right link, but also a confusing notice saying it is closed until 9/7…why do I care on 9/12?

image

Clicking on Submit Report took me to:

https://fishunt.dfw.wa.gov/wa/crabreport 

(that would have been great to include on the postcard!)

Minor rant over.

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

I posted significant updates to BindingFinder today. The goal of bindingFinder, as I discussed on Twitter, has evolved to provide compile type checking of Bindings in your XAML.

In order to do this as well as possible, BindingFinder relies on declarative hints about the typeContext of the binding. It will suggest that you add a DataType attribute to a DataTemplate. It will ask that you use d:DataContext="{d:DesignInstance foo:Customer}".

BindingFinder has not been extensively tested, so I'd love any feedback about problems that you hit. With Family.Show v3, BindingFinder found 140 bindings, and warns/errors for about 90. Once I've added a number of DataTemplate.DataType values, d:DataContext values, ValueConversionAttributes on ValueConverters, etc...and taught BindingFinder appropriate validation logic, it now is down to 23 warnings/errors. Several of those are due to bindings in Setter.Value, and a heavy use of a Binding.ElementName to find the root element of a user control.

Would love to hear feedback.

I'm not the expert on VS LightSwitch, but I know several people who are: Jay, Beth, and more...

Tim Anderson writes "Ten things you need to know about Microsoft's Visual Studio LightSwitch". Notice he mentions LightSwitch's use of XAML for model information in .LSML files.

I wrote a sample to show a coworker how to find all Bindings in a project. BindingFinder uses msbuild apis, xaml apis (from .NET + XAML Toolkit).

See http://robrelyea.com/demos/BindingFinder for links to the code and any future updates.

Example output of this command line app:

C:\Users\rrelyea\Documents\Visual Studio 2010\Projects\Bugz\Bugz>bindingfinder Bugz.csproj
FileName: App.xaml 0 bindings found
FileName: DataDesign.xaml
  Binding Path=IterationPath located at (30,18)-(30,18)
  Binding Path=Source located at (29,15)-(29,15)
  Binding Path=Area4 located at (26,17)-(26,17)
  Binding Path=Area3 located at (25,17)-(25,17)
  Binding Path=ID located at (24,14)-(24,14)
  Binding Path=Title located at (21,14)-(21,14)
FileName: MainWindow.xaml
  Binding Path=PUTriage located at (33,32)-(33,32)
  Binding Path=IterationPath located at (32,32)-(32,32)
  Binding Path=Source located at (31,32)-(31,32)
  Binding Path=Area5 located at (28,32)-(28,32)
  Binding Path=Area4 located at (27,32)-(27,32)
  Binding Path=Area3 located at (26,32)-(26,32)
  Binding Path=ID located at (24,28)-(24,28)
  Binding Path=Title located at (22,32)-(22,32)

 Here is the code that uses the XamlDom to find all bindings:

            //Iterate through each XAML file in the project
            foreach (string xamlFilePath in projectData.XamlFiles)
            {
                Console.Write("FileName: " + xamlFilePath);
                FileInfo xamlFile = projectData.GetFileInfoFromRelativePath(xamlFilePath);

                //Load XAML file into a XamlDom (which ships in the XamlToolkit - http://code.msdn.microsoft.com/xaml)
                XamlDomObject rootObject = XamlDomServices.Load(xamlFile.FullName, schemaContext);

                //Do a LinQ query on the XamlNodes in the XamlDom to find all {Bindings}
                foreach (XamlDomObject objectNode in
                    from bindings in rootObject.DescendantsAndSelf(bindingXamlType)
                    select bindings)
                {
                    GenerateOutputForObjectNode(objectNode);
                }

            }

I stole this phrase from a comment by ch00kz on the Bend text editor project on CodePlex.

I think this is something very solid to build upon. I am very big on aesthetics and this program does catch my eye and it makes me "Want" to use it.
Here are a few things i think could make this much better…

Bend – An Attractive, Inventive Text Editor

This project, a few weeks since the first download was available already has 14,000 downloads. That may have been helped by:

  1. nice Ux
  2. a nice article in LifeHacker: Bend is an Attractive, Inventive Text Editor
  3. clickonce installation on their codeplex page.

Catch their eye, make a wave…

It might be a good strategy for your software…but don’t forget to satisfy more than catching their eye. If you make them “want” to use it, they’ll give you feedback on what else your software needs to do to win their heart.

Commercial

Try out Silverlight or WPF to make your wave.

A few things brought this topic to my mind recently.

1) Chris Lovett asked me for a poster. I had no clue, but he eventually found Interknowlogy’s John Bowen’s work. (couldn’t find where the higher res photos are on the Interknowlogy website…) (also, “seeing in xaml” looks like an interesting talk.)

2) Saw the simpler class hierarchy diagram from Sean Sexton at “#27 – Class Hierarchy

 

Do you have other visualizations that have been helpful to you, as you’ve code Silverlight or WPF? Tell us about them…

 

This makes me think of some of the visio based diagrams we first did as we debated how content worked, how panels worked, etc… I’ll have to post pictures of them, cause I still have them around somewhere…

It also reminded me about my post from 11/6/2003 about “Avalons’s 5 Element Families” which is 80% down the page of http://www.windows-now.com/blogs/rrelyea/archive/2003/11.aspx.

Posted by Rob_Relyea | with no comments
Filed under: ,

Interesting to see Davy Brion’s critique of MVVM and series explaining MVP in Silverlight/WPF. As a member of the Silverlight/WPF team, I want to ensure that our platforms enable exploring best practices for UI construction. I believe that Data Driven UI is a major benefit of Silverlight/WPF.

Definitely interested to see how these best practices evolve. In the end, I just want you all to build great software for your users! If MVVM helps you, use it. If it gets in your way, find another way.

Ideally, Silverlight/WPF/Blend/VS should be flexible enough to support any of these patterns. When they are not, please be vocal with your feedback.

A few links that may help you understand how to ensure your WPF applications are accessible.

1) Ivo Manolov – “Application Accessibility Testing

A lot of our customers and partners have asked us to provide guidance on how to make their WPF and Silverlight applications accessible, so I decided to publish a post folks can refer to. Note most of the content below is directly applicable to any other Windows application.

2) MSDN content on WPF Accessibility

Accessibility Best Practices
UI Automation Fundamentals
UI Automation Providers for Managed Code
UI Automation Clients for Managed Code
UI Automation Control Patterns
UI Automation Text Pattern
UI Automation Control Types
UI Automation Specification and Community Promise

 

3) Alvin Bruney – “A Pragmatic Approach to WPF Accessibility”, CODE Magazine

In my experience, WPF has made the most progress on the accessibility front by far. However, you cannot rely on a platform and tools alone to cover accessibility mandates. The onus is on you to design for accessibility so that you can deliver a better product to your clients.

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

I tweeted a pointer to David Poll’s “To XAML with Love (an experiment with XAML Serialization in Silverlight)” recently. Wanted to make sure I did a short blog post about it, as it is worthy of more than just a quick tweet!

I’m really happy with the progress of the XAML engine in Silverlight. First, Silverlight 4 does a XAML Parse Overhaul, now a XamlWriter.Save for Silverlight from David.

Since you can now Read and Write XAML in Silverlight (like you can do on WPF since v3), that opens many scenarios where XAML may be useful.

Perhaps:

Please give David feedback on his experiment with XAML Serialization.

(oh, and thanks to David for putting his passion for great software into this experiment!)

As always, love to see Silverlight/WPF community members publish info about their successes. Even better is when they share components, best practices, and fill in developer experience holes.

 

Michael “The Synergist” Scherotter has published about 2 of his contributions this month:

1) Word to XAML Converter Updated – supports WPF4/Silverlight4, integrates into Word

2) ValueConverter item template for VS published and available as VS Extension for Silverlight or WPF.

Thanks!

Next page »
Page view counter