<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dial on Ash Tewari</title><link>https://www.tewari.info/tag/dial/</link><description>Recent content in Dial on Ash Tewari</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Wed, 11 Jun 2008 06:49:43 +0000</lastBuildDate><atom:link href="https://www.tewari.info/tag/dial/feed.xml" rel="self" type="application/rss+xml"/><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></channel></rss>