Geeks With Blogs
Bob's Occasionally* Sane Thoughts *Never

When I first started learning Surface I quickly realized how to turn a WPF app into a surface app.  Basically, I did a search and replace for each control in the WPF app that has a matching control in Surface such as Button and TextBox.  By doing simple replacements I was able to get a surface app up and running quickly.  However, I recently learned a way to really extend this method.

All you need to do is edit the control template for the particular WPF control (that doesn’t have a surface twin) and in the template convert all instances of Button into s:SurfaceButton, all instances of Slider into s:SurfaceSlider, and the Thumb into s:SurfaceThumb, etc..  Just make sure you change both the controls themselves, as well as the control styles (for instance, if the first control in the template is a <Button> and it has a <Button.Style>, so change this to <s:SurfaceButton> and <s:SurfaceButton.Style>).

See my previous blog post for a way to get at the entire default control template for editing.

Posted on Sunday, May 10, 2009 1:32 PM Microsoft Surface , WPF | Back to top

Comments on this post: Microsoft Surface – Turning WPF controls into Surface controls

Comments are closed.
Comments have been closed on this topic.
Copyright © robertbunn | Powered by: