Changing the DataTemplate based on the Available Space – SizeBasedTemplateSelector - by LearnWPF

DataTemplates are a pretty useful feature in WPF, but wouldn’t it be great if you could change the data template based on the size available to display the data? Several media players (including the Zune player) present a kind of ‘postage-stamp-sized’ UI when shrunk below a certain size. Date columns in the Finder in OSX are another example of UI that adjusts to the available space – as the width of the column increases the format of the date changes to show more information. I wanted to bring this kind of capability to WPF.




Read More from: Original Source


Post Contributed by: Kunal Chowdhury

Friday, August 12, 2011


Kunal is the Site Admin and Contributor of Silverlight-Zone. He is a Software Engineer, Microsoft Silverlight MVP, Code Project Mentor and a Code Project MVP. He is also an active Author in SilverlightShow.net and a speaker in various community events. He works on Microsoft Platform and very passionate about Silverlight technology. He started his career in 2007 and achieved various awards during his professional life.

He shares his findings in his personal blog: http://www.kunal-chowdhury.com and he also tweets at: @kunal2383.

.NET 4.5 (3) 3D (14) AdMob (1) Adobe (5) Agile (3) Amazon (1) Android (26) Animation (38) AntiVirus (1) API (2) Apollo (1) Apple (3) ASP.Net (6) AsyncCTP (8) Authentication (11) AVG (1) Award (4) Azure (44) Balder (2) Bing (43) Blend (152) Book (12) Build (18) C# (4) Cacoo (1) Catel (1) Ch9 (42) Clinch (2) Cloud (7) CodeMagazine (7) CodePlex (20) CodeProject (163) Coding4Fun (15) COM (12) ComponentOne (6) Control (55) Controls (5) Cookbook (2) CRM (1) Crud (4) CSS (11) CSS3 (7) CWC2011 (1) Database (51) Delphi (1) DependencyInjection (1) DevComponents (7) DevCurry (2) DevTools (1) Digg (1) DigitalRune (1) DirectX (6) dotNet (3) DotNetCurry (5) DotNetNuke (3) DropBox (4) eBook (17) Encoder (1) EntityFramework (5) Events (18) Exam (13) Excel (1) Exchange (1) Expression (75) ExpressionDesign (4) ExpressionWeb (1) Facebook (21) Fiddler (2) Flash (4) Flex (2) Flickr (3) FSharp (1) Game (65) GitHub (1) Giveaway (4) Google (17) GPS (3) Graphics (1) GZip (1) Hack (1) HowTo (1) HTML (116) HTML5 (80) IE (12) IE10 (2) IE9 (1) IIS (2) Illustrator (1) ImagineCup (1) Infragistics (16) Interview (2) iOS (9) iPad (4) iPhone (9) IronPython (1) JavaScript (38) Jounce (8) jQuery (10) JSON (20) JustCode (1) KendoUI (1) Kindle (1) Kinect (22) Knockout (1) Library (2) LightSwitch (308) LightSwitchTutorial (28) Linq (22) Linux (1) Localization (1) Lumia (26) Mac (4) Mango (455) MCPD (1) MediaElement (1) MEF (23) Metro (335) Mindscape (3) MIX11 (13) ModernUI (47) Mono (1) Moonlight (1) MSDN (14) MSEXP (46) MultiTouch (1) MVC (5) MVC3 (1) MVP (7) MVPChat (1) MVVM (282) NESL (5) News (114) Ninject (2) Nokia (49) NuGet (4) NUnit (1) NVidia (1) oAuth (2) oData (50) Office (1) Office365 (1) OneNote (1) OOB (21) Opus (1) Outlook (1) PDC2010 (8) PDF (4) Performance (43) PhoneGap (31) Photoshop (6) PHP (2) Physics Library (7) Picasa (1) PInvoke (3) PivotViewer (23) Poll (1) PowerPoint (2) PowerShell (2) Prism (37) Prism4 (12) Programming Languages (1) PSD (1) PUG (4) Python (1) RavenDB (1) ReactiveExtension (7) RegEx (1) ReSharper (3) Rest (5) RIA (27) RIAServices (44) Ribbon (3) RichTextBox (1) RSS (10) Ruby (1) Samsung (2) Scrum (3) Security (18) SevenDrops (1) SharePoint (30) Silverlight (1947) Silverlight3 (5) Silverlight4 (162) Silverlight5 (245) Silverlight6 (4) SilverlightBehavior (47) SilverlightCream (36) SilverlightShow (135) SilverlightTV (13) SilverlightZone (26) Sketchflow (14) SkyDrive (16) Skype (8) SLSpy (2) SMF (1) SoapUI (1) Socket (9) SQL (65) SQLCE (38) SQLite (2) sqllite (2) StackOverflow (1) Sterling (6) Storage (1) Style (58) Surface (12) SVG (2) Sync (1) syncfusion (2) Tango (1) TCP (2) TeamPulse (9) TechEd (1) Telerik (283) telerik wpf (1) TelerikMetro (25) Testing (7) TFS (2) Theme (30) Thread (1) Tips (464) Toolkit (49) Tools (4) Training (3) TrainingKit (2) Trigger (6) Troubleshooting (1) Tutorial (326) Twitter (24) TypeMock (1) TypeScript (4) UDP (2) UnitTesting (9) Unity3D (2) Validation (16) VB (5) Video (105) VideoTutorial (71) Visual Studio 2011 (35) VisualStudio (194) VisualStudio11 (2) VisualStudio2011 (36) VisualStudio2012 (36) VLC (1) VMWare (1) VSM (6) VTD (1) WCF (118) Win8 (787) Win8Dev (320) win9 (1) Windows (72) windows 8 (1) Windows Phone (79) Windows7 (2) Windows8 (679) WindowsBlue (7) windowsphone (10) WindowsStoreApp (97) Winform (1) WinHost (1) WinJS (3) WinRT (413) WMV (1) WordPress (3) WP (780) WP7 (2950) WP7.5 (61) WP7.8 (15) WP7Contrib (18) WP7Dev (1563) WP7Exam (1) WP7Toolkit (10) WP8 (240) WP8Dev (235) WPDev (1112) WPF (246) wpmwp7 (1) XAML (654) XAP (10) XBox (11) XML (5) XNA (104) XPG (4) XPS (1) YouTube (7) Zune (5)

The Site has been hosted by Kunal Chowdhury   © 2011

Back to TOP