<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>XAML on Ash Tewari</title><link>https://www.tewari.info/tag/xaml/</link><description>Recent content in XAML on Ash Tewari</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Sat, 23 May 2020 02:57:40 +0000</lastBuildDate><atom:link href="https://www.tewari.info/tag/xaml/feed.xml" rel="self" type="application/rss+xml"/><item><title>Universal Windows Platform Application on Raspberry Pi</title><link>https://www.tewari.info/2020/05/22/universal-windows-platform-application-on-raspberry-pi/</link><pubDate>Sat, 23 May 2020 02:57:40 +0000</pubDate><guid>https://www.tewari.info/2020/05/22/universal-windows-platform-application-on-raspberry-pi/</guid><description>&lt;p&gt;Universal Windows Platform (UWP) provides a common app platform on every device that runs Windows 10. The core APIs in UWP are the same on all Windows devices – including Desktop PC, Mobile Phone, XBox, Hololens, IOT devices and &lt;a class="link" href="https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide" target="_blank" rel="noopener"&#10; &gt;others&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;You can target specific device capabilities of a device family with &lt;a class="link" href="https://docs.microsoft.com/en-us/uwp/extension-sdks/device-families-overview#extension-sdks" target="_blank" rel="noopener"&#10; &gt;extension SDKs&lt;/a&gt;, but you don&amp;rsquo;t have to do that if you are only using core APIs. Those core APIs include a very &lt;a class="link" href="https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/" target="_blank" rel="noopener"&#10; &gt;impressive&lt;/a&gt; set of UI capabilities. What that means is that you can create a UWP application using C# and XAML which will run on an ARM based processor on Raspberry Pi – because &lt;a class="link" href="https://docs.microsoft.com/en-us/windows/iot-core/develop-your-app/buildingappsforiotcore" target="_blank" rel="noopener"&#10; &gt;Windows 10 IOT Core&lt;/a&gt; runs on that.&lt;/p&gt;&#10;&lt;p&gt;Universal Windows Platform (&lt;a class="link" href="https://docs.microsoft.com/en-us/windows/apps/desktop/choose-your-platform" target="_blank" rel="noopener"&#10; &gt;UWP&lt;/a&gt;) has come &lt;a class="link" href="https://www.tewari.info/2014/11/12/universal-apps/" &gt;a long way&lt;/a&gt;. I decided to dust off my good old Raspberry Pi 2B and take it for a spin last weekend.&lt;/p&gt;&#10;&lt;p&gt;The goal was simply to create a Hello World UWP application, deploy it on Windows 10 IOT running on Raspberry Pi (RPi), without using any device specific extension SDKs. Here is the stack -&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a class="link" href="https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide" target="_blank" rel="noopener"&#10; &gt;Universal Windows Platform App&lt;/a&gt; (C#/XAML)&lt;/li&gt;&#10;&lt;li&gt;Raspberry Pi &lt;a class="link" href="https://www.raspberrypi.org/products/raspberry-pi-2-model-b/" target="_blank" rel="noopener"&#10; &gt;Model 2B&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="https://docs.microsoft.com/en-us/windows/iot-core/windows-iot-core" target="_blank" rel="noopener"&#10; &gt;Windows 10 IOT Core&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="https://www.syncfusion.com/uwp-ui-controls" target="_blank" rel="noopener"&#10; &gt;Syncfusion Essential Studio&lt;/a&gt; &lt;a class="link" href="https://help.syncfusion.com/common/essential-studio/release-notes/v18.1.0.42" target="_blank" rel="noopener"&#10; &gt;18.1.0.42&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="https://visualstudio.microsoft.com/" target="_blank" rel="noopener"&#10; &gt;Visual Studio&lt;/a&gt; 2019&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://docs.microsoft.com/en-us/windows/uwp/get-started/create-a-hello-world-app-xaml-universal" target="_blank" rel="noopener"&#10; &gt;Create&lt;/a&gt; a simple UWP application in Visual Studio 2019.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;&lt;a class="link" href="https://docs.microsoft.com/en-us/windows/iot-core/tutorials/rpi" target="_blank" rel="noopener"&#10; &gt;Install&lt;/a&gt; Windows 10 IOT Core on Raspberry Pi 2B and connect the device to a 50&amp;quot; screen TV.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-5.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/Rpi2BOnTV.jpg"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Select ARM in the target platform drop down and Click on Remote Machine to Run/Debug Application on RPi device.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-1.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Select RPi device for deployment.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-2.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Deployment of UWP on RPi is complete.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-3.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;UWP application running on RPi.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image.jpeg"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;I updated the UWP application to include &lt;a class="link" href="https://help.syncfusion.com/uwp/charts/getting-started?cs-save-lang=1&amp;amp;cs-lang=csharp" target="_blank" rel="noopener"&#10; &gt;Syncfusion Chart&lt;/a&gt; control. Did you know that you can get a &lt;a class="link" href="https://www.syncfusion.com/products/communitylicense" target="_blank" rel="noopener"&#10; &gt;Community License&lt;/a&gt; for the entire product line (including Blazor, Xamarin and UWP controls) from Syncfusion?&lt;/p&gt;&#10;&lt;p&gt;UWP application is now running on RPi, attached to the Visual Studio debugger running on the development machine (Windows Surface).&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-1.jpeg"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;No device specific extension SDKs were referenced, just the core UWP APIs were used.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/image-6.png"&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Code is on &lt;a class="link" href="https://github.com/ashtewari/CoronaViewer/blob/master/CoronaViewer/MainPage.xaml.cs" target="_blank" rel="noopener"&#10; &gt;github&lt;/a&gt;.&lt;/p&gt;&#10;</description></item><item><title>Universal Apps</title><link>https://www.tewari.info/2014/11/12/universal-apps/</link><pubDate>Thu, 13 Nov 2014 02:50:36 +0000</pubDate><guid>https://www.tewari.info/2014/11/12/universal-apps/</guid><description>&lt;p&gt;The story of Windows Universal Apps is the result of advancements in three areas:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;The platform convergence between Windows 8.1 and Windows Phone 8.1&lt;/li&gt;&#10;&lt;li&gt;The (ongoing) unification of Windows and Windows Phone stores.&lt;/li&gt;&#10;&lt;li&gt;Shared Projects and other enhancements in Visual Studio 2013 Update 2 to support cross-platform development.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.tewari.info/wp-content/universal-apps-titile.png" &gt;&lt;img loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/universal-apps-titile.png"&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;I have written about my experience in converting an existing Windows 8 app, &lt;a class="link" href="http://blog.appliedis.com/2012/10/22/censusmapper-app-mashup-census-data-with-bing-maps/" target="_blank" rel="noopener"&#10; &gt;CensusMapper&lt;/a&gt;, to a Universal App on the &lt;a class="link" href="http://blog.appliedis.com/author/ash-tewari/" target="_blank" rel="noopener"&#10; &gt;AIS Blog&lt;/a&gt;. &lt;a class="link" href="http://blog.appliedis.com/2014/10/05/censusmapper-is-a-universal-app/" target="_blank" rel="noopener"&#10; &gt;Read the article here&lt;/a&gt;. I have also created another Universal App, LRMS, using Windows &lt;a class="link" href="http://appstudio.windows.com/" target="_blank" rel="noopener"&#10; &gt;App Studio&lt;/a&gt;. This app is available in both &lt;a class="link" href="http://apps.microsoft.com/windows/en-us/app/454df9ae-7a9d-40f2-8caf-5266649939d9" target="_blank" rel="noopener"&#10; &gt;Windows&lt;/a&gt; and &lt;a class="link" href="http://www.windowsphone.com/en-us/store/app/lrms/497cb5bb-1d37-4c66-a200-912b39872f6c" target="_blank" rel="noopener"&#10; &gt;Windows Phone&lt;/a&gt; Stores.&lt;/p&gt;&#10;&lt;p&gt;I gave a presentation at the &lt;a class="link" href="http://www.codecamp.org/Raleigh/" target="_blank" rel="noopener"&#10; &gt;Raleigh Code Camp&lt;/a&gt; this past weekend : Creating Universal Apps for Windows Phone 8.1 and Windows 8.1. Thanks to everyone who attended the presentation. The session slides for this presentation are available here : &lt;a class="link" href="http://1drv.ms/1GQSJI6" target="_blank" rel="noopener"&#10; &gt;Download Slides&lt;/a&gt;.&lt;/p&gt;&#10;</description></item><item><title>Creating Windows 8 applications with MVVM</title><link>https://www.tewari.info/2014/01/11/creating-windows-8-applications-with-mvvm/</link><pubDate>Sat, 11 Jan 2014 20:10:52 +0000</pubDate><guid>https://www.tewari.info/2014/01/11/creating-windows-8-applications-with-mvvm/</guid><description>&lt;p&gt;TRINUG January Main Meeting&lt;/p&gt;&#10;&lt;p&gt;You will learn how to use MVVM in your own Windows 8 application - desktop/mobile&#10;You will learn MVVM fundamentals. You will see the contrast between an MVVM application and a non-MVVM application.&lt;/p&gt;&#10;</description></item><item><title>Using Layer Diagrams – Keeping your MVVM code from turning into spaghetti</title><link>https://www.tewari.info/2013/11/09/raleigh-code-camp-2013/</link><pubDate>Sat, 09 Nov 2013 20:46:16 +0000</pubDate><guid>https://www.tewari.info/2013/11/09/raleigh-code-camp-2013/</guid><description>&lt;p&gt;&lt;a class="link" href="http://codecamp.org/Raleigh" title="Raleigh Code Camp"&#10; target="_blank" rel="noopener"&#10; &gt;Raleigh Code Camp 2013&lt;/a&gt; is wrapping up this afternoon. The venue and the crowd was phenomenal. I really enjoyed &lt;a class="link" href="http://codecamp.org/Raleigh/Sessions" target="_blank" rel="noopener"&#10; &gt;presenting&lt;/a&gt;&amp;ldquo;Using Layer Diagrams - Keeping your MVVM code from turning into spaghetti&amp;rdquo;. Thanks to everyone who attended the presentation.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://www.tewari.info/wp-content/codecamp2013.png" &gt;&lt;img loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/codecamp2013.png"&gt;&lt;/a&gt;&lt;a class="link" href="https://twitter.com/jsonmez" target="_blank" rel="noopener"&#10; &gt;John Sonmez&lt;/a&gt;, Our Keynote Speaker, made my day by accepting my request to attend my presentation. It was awesome to have him in the audience and to get feedback from him!&lt;/p&gt;&#10;&lt;p&gt;I did not get the time to complete the raffle at the end of the presentation. But the folks who won the raffle should be getting an email from me with instructions to download their free license of &lt;a class="link" href="http://codedemo.net/" target="_blank" rel="noopener"&#10; &gt;CodeDemo (Professional).&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;The presentation slides can be downloaded from here : &lt;a class="link" href="https://www.tewari.info/wp-content/RDUCC-2013-LayerDiagrams-MVVM-Ash-Tewari.pdf" &gt;download&lt;/a&gt;.&lt;/p&gt;&#10;</description></item><item><title>Refactoring to MVVM (Windows 8)</title><link>https://www.tewari.info/2013/05/05/refactoring-to-mvvm-windows-8/</link><pubDate>Sun, 05 May 2013 19:47:09 +0000</pubDate><guid>https://www.tewari.info/2013/05/05/refactoring-to-mvvm-windows-8/</guid><description>&lt;p&gt;Carolina Code Camp - 2013&#10;You will learn how to structure your app&amp;rsquo;s code in a way that&#10;- improves maintainability&#10;- enables testability of your app&amp;rsquo;s UI behavior&#10;- reduces maintenance cost&#10;- enables cross-platform deployment&lt;/p&gt;&#10;</description></item><item><title>Remove ListBoxItem Highlighting</title><link>https://www.tewari.info/2011/04/29/remove-listboxitem-highlighting/</link><pubDate>Sat, 30 Apr 2011 03:25:58 +0000</pubDate><guid>https://www.tewari.info/2011/04/29/remove-listboxitem-highlighting/</guid><description>&lt;p&gt;A Silverlight/Wpf ListBoxItem is highlighted when selected or when the mouse hovers over it.&lt;/p&gt;&#10;&lt;p&gt;I need to display a list of items that are not highlighted when selected. This is a common scenario when displaying an inactive list for simply listing out some information.&lt;/p&gt;&#10;&lt;p&gt;ListBoxItem&amp;rsquo;s default template can be easily inspected and modified using Expression Blend - Select a ListBoxItem in Objects and Timeline pane, Right click and select Edit template &amp;gt; Edit a Copy. Name you template and save it at the scope of your choice.&lt;/p&gt;&#10;&lt;p&gt;This will create a copy of the template and allow you to modify it. Switch to the xaml view. Locate the VisualStates of MouseOver, Selected and Focused, and blank them out -&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="de-highlighted-xaml" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/2011-04-29_2257.png"&gt;&lt;/p&gt;&#10;&lt;p&gt;The style is applied to the ListBoxItems using ItemContainerStyle -&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="applying-style-to-listboxitems" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/2011-04-29_2307.png"&gt;&lt;/p&gt;&#10;&lt;p&gt;Here is the xaml style for the ListBoxItem -&lt;/p&gt;&#10;&lt;p&gt;After the style is applied, the ListBoxItems are not highlighted when selected or focused. Here is a live demo of a ListBox that does not highlight when items are selected : &lt;a class="link" href="https://www.tewari.info/remove-listboxitem-highlighting-demo/" &gt;remove-listboxitem-hlighting-demo&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Win Advanced MVVM Book</title><link>https://www.tewari.info/2010/05/09/win-advanced-mvvm-book/</link><pubDate>Mon, 10 May 2010 03:33:06 +0000</pubDate><guid>https://www.tewari.info/2010/05/09/win-advanced-mvvm-book/</guid><description>&lt;p&gt;&lt;a class="link" href="http://joshsmithonwpf.wordpress.com/advanced-mvvm/" target="_blank" rel="noopener"&#10; &gt;&lt;img alt="Advanced MVVM Cover" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/advancedmvvmcover.jpg"&gt;&lt;/a&gt; I am presenting a session on Building WPF Application using MVVM (&lt;a class="link" href="http://en.wikipedia.org/wiki/Model_View_ViewModel" title="Wikipedia-MVVM"&#10; target="_blank" rel="noopener"&#10; &gt;Model-View-ViewModel&lt;/a&gt;) on May 15th at the &lt;a class="link" href="http://codecamp.developersguild.org/" title="Carolina Code Camp 2010"&#10; target="_blank" rel="noopener"&#10; &gt;Carolina Code Camp&lt;/a&gt; 2010.&lt;/p&gt;&#10;&lt;p&gt;I will dissect a Sample WPF MVVM application and then highlight the most important aspects of the MVVM by coding a brand new ViewModel and incorporating it into the application. You will learn about the Roles of the MVVM triad, the advantages of using MVVM and Characteristics of the ViewModel.&lt;/p&gt;&#10;&lt;p&gt;Attendees will be eligible to win two copies one copy (see below) of &lt;a class="link" href="http://joshsmithonwpf.wordpress.com/" title="Josh Smith"&#10; target="_blank" rel="noopener"&#10; &gt;Josh Smith&amp;rsquo;s&lt;/a&gt; &lt;a class="link" href="http://joshsmithonwpf.wordpress.com/advanced-mvvm/" title="advanced-mvvm-book"&#10; target="_blank" rel="noopener"&#10; &gt;Advanced MVVM book&lt;/a&gt; as well as a few other WPF Books.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;{ I will be giving away one hard copy version of the book instead of digital versions due to concerns about DRM protection and unclear gift guidelines at lulu.com }&lt;/em&gt;.&lt;/p&gt;&#10;&lt;p&gt;And the winner is &amp;hellip; Mark Freeman !!! Congratulations Mark, your copy of &amp;ldquo;Advanced MVVM&amp;rdquo; is on its way. Thanks for attending the code camp and your feedback.&lt;/p&gt;&#10;</description></item><item><title>Using Model-View-ViewModel in WPF Applications</title><link>https://www.tewari.info/2010/01/25/using-model-view-viewmodel-in-wpf-applications/</link><pubDate>Mon, 25 Jan 2010 22:23:39 +0000</pubDate><guid>https://www.tewari.info/2010/01/25/using-model-view-viewmodel-in-wpf-applications/</guid><description>&lt;p&gt;I am presenting at &lt;a class="link" href="http://www.socalcodecamp.com/" title="socalcodecamp website"&#10; target="_blank" rel="noopener"&#10; &gt;SoCalCodeCamp&lt;/a&gt; this weekend (January 30th, 2010) - &lt;a class="link" href="http://www.socalcodecamp.com/socalcodecamp/session.aspx?sid=0b2ee44f-595d-4f55-a5d6-2b1293f546d0" title="WPF MVVM Presntation "&#10; target="_blank" rel="noopener"&#10; &gt;Advanced WPF - Using Model-View-ViewModel in WPF Applications&lt;/a&gt;.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/tasklist.png"&#10;&#9;&#9;&#9;alt="tasklist-mockup"&gt;&lt;figcaption&gt;&#10;&#9;&#9;&#9;&lt;p&gt;tasklist-mockup&lt;/p&gt;&#10;&#9;&#9;&lt;/figcaption&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Agenda :&lt;/p&gt;&#10;&lt;p&gt;1. Roles of the M-V-VM triad&lt;/p&gt;&#10;&lt;p&gt;2. Why use M-V-VM ?&lt;/p&gt;&#10;&lt;p&gt;3. Characteristics of the ViewModel&lt;/p&gt;&#10;&lt;p&gt;4. Build a Sample WPF Application using M-V-VM&lt;/p&gt;&#10;&lt;p&gt;Resources :&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" title="MSDN Magazine Article"&#10; target="_blank" rel="noopener"&#10; &gt;MSDN Magazine Article&lt;/a&gt; and Sample Application &lt;a class="link" href="http://code.msdn.microsoft.com/mag200902MVVM/Release/ProjectReleases.aspx" title="Download Demo Application Code"&#10; target="_blank" rel="noopener"&#10; &gt;Download&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://martinfowler.com/eaaDev/PresentationModel.html" title="MartinFowler.com"&#10; target="_blank" rel="noopener"&#10; &gt;Martin Fowler’s description of the ‘Presentation Model ‘&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx" title="Jeremy Miller&amp;#39;s - Build Your CAB"&#10; target="_blank" rel="noopener"&#10; &gt;Jeremy Miller’s ‘Build Your Own CAB’ series&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;</description></item><item><title>Dial Gauge is a ProgressBar</title><link>https://www.tewari.info/2008/06/10/dial-gauge-is-a-progressbar/</link><pubDate>Wed, 11 Jun 2008 06:49:43 +0000</pubDate><guid>https://www.tewari.info/2008/06/10/dial-gauge-is-a-progressbar/</guid><description>&lt;p&gt;I am not just being philosophical here. In &lt;a class="link" href="http://msdn.microsoft.com/en-us/netframework/aa663326.aspx" title="MSDN-WPF"&#10; target="_blank" rel="noopener"&#10; &gt;WPF&lt;/a&gt;, &lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163497.aspx" title="Using Templates to Customize WPF Controls"&#10; target="_blank" rel="noopener"&#10; &gt;ControlTemplates&lt;/a&gt; allow you to transform a control&amp;rsquo;s appearance. This is not the same as applying stylesheets. This is an entirely new level of customization. What you see in the screenshot below looks like a Dial but is actually a simple ProgressBar control wearing a &amp;ldquo;Dial&amp;rdquo; template. The Dial template was created using &lt;a class="link" href="http://www.microsoft.com/expression/products/Overview.aspx?key=blend" title="Microsoft-Expression-Blend"&#10; target="_blank" rel="noopener"&#10; &gt;Microsoft Expression Blend&lt;/a&gt; .&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="dial-is-a-progressbar.PNG" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/images/dial-is-a-progressbar.PNG"&gt;&lt;/p&gt;&#10;&lt;p&gt;Include the ControlTemplate as a Window.Resource and then assign it to ProgressBar element&amp;rsquo;s Template attribute :&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course that is not all. The ControlTemplate must define some named elements of FrameworkElement type. Charles Petzold has explained it in detail : &lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163497.aspx" title="Charles-Petzold-Using Templates to Customize WPF Controls"&#10; target="_blank" rel="noopener"&#10; &gt;MSDN Magazine Article&lt;/a&gt;. So, I will not repeat it here.&lt;/p&gt;&#10;&lt;p&gt;The sample code can be downloaded here : &lt;a class="link" href="https://www.tewari.info/downloads/DialTest.zip" title="DialTest.zip"&#10; &gt;DialTest.zip&lt;/a&gt;&#10;License : &lt;a class="link" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" target="_blank" rel="noopener"&#10; &gt;Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Using Custom Converter in XAML</title><link>https://www.tewari.info/2008/04/15/using-custom-converter-in-xaml/</link><pubDate>Wed, 16 Apr 2008 05:22:12 +0000</pubDate><guid>https://www.tewari.info/2008/04/15/using-custom-converter-in-xaml/</guid><description>&lt;p&gt;In my previous post : &lt;a class="link" href="https://www.tewari.info/2008/03/07/wpf-linq-to-sql-sample/" title="wpf-linq-to-sql-sample"&#10; &gt;WPF-LINQ To SQL Sample&lt;/a&gt;, I had to resort to modifying .dbml file to get the images stored as varbinary into the WPF ListView control. I had to change the Type of image fields to System.Byte[], instead of using System.Data.Linq.Binary. A better way to do this is to use a custom converter. WPF allows you to specify custom converter as part of the Binding in .xaml, like this -&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;Image Grid.Row=&amp;#34;2&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Source=&amp;#34;{Binding Path=ThumbNailPhoto ,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Converter={StaticResource imageConverter}}&amp;#34;&amp;gt;&amp;lt;/Image&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The custom converter is declared in the same .xaml file as a resource -&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;Window.Resources&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;local:ImageDataConverter x:Key=&amp;#34;imageConverter&amp;#34; /&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/Window.Resources&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;ImageDataConverter is implemented in .xaml.cs file -&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;public class ImageDataConverter : IValueConverter&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; public object Convert(object value, Type targetType, object parameter,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; System.Globalization.CultureInfo culture)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; byte[] image = ((System.Data.Linq.Binary)value).ToArray();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; return image;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; public object ConvertBack(object value, Type targetType, object parameter,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; System.Globalization.CultureInfo culture)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; throw new NotSupportedException();&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The updated sample code can be downloaded here : &lt;a class="link" href="https://www.tewari.info/downloads/Linq2SqlSample2.zip" title="Linq2SqlSample2.zip"&#10; &gt;WPF-LINQ to SQL Sample&lt;/a&gt;&#10;License : &lt;a class="link" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" target="_blank" rel="noopener"&#10; &gt;Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.&lt;/a&gt;&lt;/p&gt;&#10;</description></item></channel></rss>