{"id":172,"date":"2008-05-01T20:19:03","date_gmt":"2008-05-02T01:19:03","guid":{"rendered":"http:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/172"},"modified":"2008-05-01T20:19:03","modified_gmt":"2008-05-02T01:19:03","slug":"silverlight-it-aint-your-papas-wpf","status":"publish","type":"post","link":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/172","title":{"rendered":"Silverlight — it ain’t your papa’s WPF"},"content":{"rendered":"

John Gossman, architect of the WPF team (desktop and subset taht supplies UI framework for Silverlight), discusses<\/a> a few of the pain points developers and designers are facing today with WPF to Silverlight portability. From his post:<\/p>\n

\n

The above example is a bit of a special case, and I don’t feel bad about it at all.  A much greater struggle that hits a very large number of users is how we do Control templating.  All of the APIs we use in Silverlight’s Beta1 control templating model exist in desktop WPF, and yet the templates are completely different.  By subsetting the APIs we ended up changing not just the best practices, but the essential model.  <\/p>\n

Let me be clear.  If you write your own custom control in Silverlight, using the Silverlight model, you can create a template for it and take your custom control and its template and run them on desktop WPF.  The problem is, we do not provide Triggers in Silverlight and many of the properties (IsMouseOver, IsPressed) that Triggers depend on to work.  There are technical reasons Triggers were hard to add in Silverlight 2 (though we will add them in the future), but even greater was the test and development cost of adding all the additional properties necessary to make them work.  So, we decided to make the controls have to “trigger” the state changes themselves in code.  All this code works on desktop WPF.  But existing controls, written for the desktop, don’t contain the code to “trigger” the state changes, so the control templates don’t do anything when applied (they create their children, but don’t react to events).<\/p>\n<\/blockquote>\n

The more I consider this … the less I care about portability specifically between WPF and Silverlight. It’s unlikely that I’ll ever be able to use or need to use code exactly as it was written for a desktop WPF application (yes, there will be elements that are worth copying — but I believe that a full installed application should work differently from an enhanced web page with Silverlight). If I’m running a WPF app — I’m running a thick, rich, installed application (or click-once). If I’m writing something for Silverlight, I need to write code which lives within the confines of the browser. Although similar, they’re still quite different on many levels.<\/p>\n

That being said, I would like the models to be the same — if only because I’ve really become fond of many of the WPF features and techniques for building a user interface: triggers, triggers, and triggers. I can absolutely live without 3D and even without a full .NET framework. But triggers really help separate the UI from the code. I’ve done some investigation and I can’t see how I could create a reasonable approximation of Triggers without a lot of work — and even then it wouldn’t be compatible with WPF XAML. John said “when we add triggers…” …, so it gives me a bit of hope (albeit with no time tables…).<\/p>\n","protected":false},"excerpt":{"rendered":"

John Gossman, architect of the WPF team (desktop and subset taht supplies UI framework for Silverlight), discusses a few of the pain points developers and designers are facing today with WPF to Silverlight portability. From his post: The above example is a bit of a special case, and I don’t feel bad about it at […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[4],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pd5QIe-2M","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":668,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/668","url_meta":{"origin":172,"position":0},"title":"Silverlight Stars\/Sparkles","date":"January 18, 2009","format":false,"excerpt":"I was in a \u201cstar\u201d mood this afternoon and created this Silverlight 2.0 demonstration. For rendering it uses the CompositionTarget.Rendering method (the easiest way to control dynamic animations such as this). It also uses the VisualStateManager in a variety of places to control the user interface. I\u2019ve become a big\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2009\/01\/image7.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":633,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/633","url_meta":{"origin":172,"position":1},"title":"A Silverlight 2 TilePanel","date":"December 14, 2008","format":false,"excerpt":"You may notice that the Silverlight TileBrush is missing some key properties which would enable it to actually tile a brush. The WPF TileBrush has properties such as TileMode, Viewbox, and ViewportUnits that can be used to tile an image as a fill or as a background for a UIElement.\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/12\/image1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":273,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/273","url_meta":{"origin":172,"position":2},"title":"Flash 10 — should make Flex (and AIR) even better …","date":"May 15, 2008","format":false,"excerpt":"The battle for the RIA platform continues with Adobe's pre-release of the next version of Flash 10, code named Astro (details here). If you're familiar with WPF -- the Flash player is starting to have a near feature parity with WPF. Oh, I know, I know, I'm sure there are\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/05\/image17.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":389,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/389","url_meta":{"origin":172,"position":3},"title":"Silverlight (and Flex), not for LOB applications?","date":"June 27, 2008","format":false,"excerpt":"Shawn suggests that line of business applications should not be written using Silverlight (and hence Flex), instead XBAPs (the run in browser Windows-only WPF solution). IT shops, with trimmed budgets and staff, have little time to maintain workstations and troubleshoot interactions between various installed applications. Web applications, although they may\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":388,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/388","url_meta":{"origin":172,"position":4},"title":"Silverlight Weather Demonstration","date":"June 26, 2008","format":false,"excerpt":"Demonstration available here. (You'll need to wait for a moment while it loads the first time). I've created a reasonably simple, yet multi-technology (and discipline) demonstration using Silverlight for the user interface and ASP.NET as the back-end. The demonstration uses: Silverlight 2.0 Data binding Delayed downloading of images \"Web services\"\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/06\/image21.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":458,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/458","url_meta":{"origin":172,"position":5},"title":"JavaScript ASP.NET Data Templates (or, I was missing Data Templates in Silverlight …)","date":"August 11, 2008","format":false,"excerpt":"After you taste Data Templates in Silverlight and WPF, you won't want to go back to your old way of building user interfaces. I mean seriously, do you like the idea of building a user interface by custom drawing a list box using various owner-drawn techniques like exist in Win32?\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/08\/image-thumb1.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/172"}],"collection":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/comments?post=172"}],"version-history":[{"count":0,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/172\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}