<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>jfo's coding</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jfoscoding/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jfoscoding/feed.xml</link>
    <description>adventures in windows forms and wpf</description>
    <lastBuildDate>Sat, 04 Apr 2015 12:32:30 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Blog has moved ...</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/blog-has-moved</link>
      <pubDate>Wed, 09 Mar 2011 15:52:51 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2011/03/09/blog-has-moved/</guid>
      <description><![CDATA[I am back blogging at https://jfoscoding.blogspot.com/!&nbsp; See you over there!&nbsp; ]]></description>
      <content:encoded><![CDATA[<p>I am back blogging at <a href="https://jfoscoding.blogspot.com/">https://jfoscoding.blogspot.com/</a>!&nbsp; See you over there!&nbsp; </p>]]></content:encoded>
    </item>
    <item>
      <title>Random tip of the day: adding a shortcut to all desktops in Windows Vista Server 2008</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/random-tip-of-the-day-adding-a-shortcut-to-all-desktops-in-windows-vista-server-2008</link>
      <pubDate>Wed, 18 Nov 2009 17:56:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/11/18/random-tip-of-the-day-adding-a-shortcut-to-all-desktops-in-windows-vista-server-2008/</guid>
      <description><![CDATA[I've been puzzling how to do this for a little while, as I had some common shortcuts I wanted to add...]]></description>
      <content:encoded><![CDATA[<P>I've been puzzling how to do this for a little while, as I had some common shortcuts I wanted to add to the desktop for everyone on my team to use.</P>
<P>The way to do this in Windows XP has been to use the "All Users" account and add to the desktop folder.&nbsp; The process is the same for Windows Vista, but "All Users" has been renamed "Public" and the "Desktop" folder is hidden by default.</P>
<P>To create shortcuts for everyone either</P>
<UL>
<LI>Open Windows Explorer (Easiest way is Windows key&nbsp;+ e)</LI>
<LI>Type "C:\Users\Public\Desktop" directly </LI>
<LI>Add shortcut to this folder</LI></UL>
<P>Or unhide all the folders and navigate there</P>
<UL>
<LI>Open Windows Explorer (Easiest way is&nbsp; Windows key&nbsp;+ e)</LI>
<LI>Press Alt to show the menu</LI>
<LI>Open Tools-&gt;Folder options menu</LI>
<LI>Select View tab</LI>
<LI>For the Hidden Files and folders option check "show hidden files and folders"</LI>
<LI>Now navigate to c:\users\public\desktop, you'll actually see it but it's ghosted out (because it's a hidden folder).</LI>
<LI>Add shortcut to this folder</LI></UL>
<P>I'm sure there's a million other ways to do this -- but I hope this helps!</P>]]></content:encoded>
    </item>
    <item>
      <title>Beta2 is out -- What's new in Cider</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/beta2-is-out-whats-new-in-cider</link>
      <pubDate>Mon, 26 Oct 2009 15:36:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/10/26/beta2-is-out-whats-new-in-cider/</guid>
      <description><![CDATA[Mark&nbsp;shows off some of the new and exciting features in Cider Beta 2, including:

DataSources...]]></description>
      <content:encoded><![CDATA[<P>Mark&nbsp;shows off some of the <A href="https://channel9.msdn.com/posts/Jaime+Rodriguez/Whats-new-in-the-WPF-and-Silverlight-Cider-Designer-in-VS2010-beta2/" mce_href="https://channel9.msdn.com/posts/Jaime+Rodriguez/Whats-new-in-the-WPF-and-Silverlight-Cider-Designer-in-VS2010-beta2/">new and exciting features in Cider Beta 2</A>, including:</P>
<UL>
<LI>DataSources window now works in Silverlight (as well as WPF)&nbsp;- you can now drag and drop from this window to your design surface to automatically hook up to data.</LI>
<LI>Property Inspector window gets a facelift&nbsp; --&nbsp; now lets you sort by property source (e.g. see all the locally set versus inherited properties grouped together)</LI>
<LI>{d:DataContext} markup extension lets you set design time data across Cider and Blend.</LI>
<LI>UserControls can now use resources from App.xaml</LI>
<LI>Designer now loads with broken controls -- a red x shows you the control that could not load, and a gold bar shows you the exact exception.&nbsp; Previously you would have only gotten a "Problem Loading" screen.</LI></UL>
<P>We would love to <A href="https://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/threads" mce_href="https://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/threads">get your feedback</A> on these new features!&nbsp;</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>High DPI - it's an everyone thing.</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/high-dpi-its-an-everyone-thing</link>
      <pubDate>Sun, 11 Oct 2009 16:07:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/10/11/high-dpi-its-an-everyone-thing/</guid>
      <description><![CDATA[As larger displays are becoming more popular, they're increasingly being used in places like the...]]></description>
      <content:encoded><![CDATA[<P>As larger displays are becoming more popular, they're increasingly being used in places like the livingroom.&nbsp; And if you've ever tried to read text across the room with the default DPI setting, you'll find you&nbsp;may need&nbsp;a pair of opera glasses.</P>
<P>In Windows 7, if you're using a larger display, the OS will automatically adjust for you, in the hopes that you will be more likely to be able to read text.</P>
<BLOCKQUOTE>
<P><EM>From this we see that there is a real end user benefit to tap into here. It turns out that there is existing infrastructure in Windows called “High DPI” which can be used to address this. High DPI is not a new feature for Windows 7, but it was not until Vista that the OS user-interface made significant investments in support for high DPI (beyond the infrastructure present earlier). To try this out in Vista, rt. Click desktop -&gt; personalize and select “Adjust Font Size (DPI)” from the left hand column. Our thinking for Windows 7 was that if we enable high DPI out of the box on capable displays, we will enable users to have a full-fidelity experience and also significantly reduce eye strain for on-screen reading. There is even infrastructure available to us to detect a display’s native DPI so we can do a better job of configuring default settings out of the box. However, doing this will also open up the door to expose some issues with applications which may not be fully compatible with high DPI configurations. - <A href="https://blogs.msdn.com/e7/archive/2008/09/13/follow-up-on-high-dpi-resolution.aspx" mce_href="https://blogs.msdn.com/e7/archive/2008/09/13/follow-up-on-high-dpi-resolution.aspx">Engineering Windows 7</A></EM></P></BLOCKQUOTE>
<P>It may be worth a look to see what your app looks like in 120 DPI.&nbsp; In both windows forms and WPF, good use of the AutoSize features usually accomodates most scaling issues.&nbsp; It can be tricky to set up, but once it works, it usually works well.</P>
<P><STRONG>Windows Forms</STRONG> lets you set everything in pixels, and then during the loading process, it uses the AutoScale feature to magically multiply whatever you said by however bigger and/or smaller things are supposed to get.&nbsp;How much bigger/smaller things get is best calculated by taking the font size of the Form when you designed it (which is what AutoScaleBaseSize, AutoScaleDimensions are), then taking the new font size as currently run on the system.&nbsp; The percent difference in size is used to adjust the size/location of controls. </P>
<BLOCKQUOTE>
<P><EM>For windows forms, check out the </EM><A href="https://www.windowsclient.net/Samples/Go%20To%20Market/Layout/layoutGTM.doc" mce_href="https://www.windowsclient.net/Samples/Go%20To%20Market/Layout/layoutGTM.doc"><EM>"AutoScale" section</EM></A><EM> of this layout FAQ for tips as to how to use AutoScaleDimensions.&nbsp;</EM></P></BLOCKQUOTE>
<P><STRONG>WPF</STRONG> uses Device Independent Units, which is a fake unit that makes you always think you're drawing in 96DPI.&nbsp; When it goes to render to the screen, it translates the DIU to DPI doing the math under the hood for you.&nbsp;&nbsp;Charles Petzold does a good job explaining <A href="https://www.charlespetzold.com/blog/2005/11/250723.html" mce_href="https://www.charlespetzold.com/blog/2005/11/250723.html">how the math works</A>.&nbsp; For the most part this system works well,&nbsp;though you need to know the tricks for&nbsp;<A href="https://blogs.windowsclient.net/makerofthings/archive/2008/05/07/BlurryWPFSilverlight.aspx" mce_href="https://blogs.windowsclient.net/makerofthings/archive/2008/05/07/BlurryWPFSilverlight.aspx">image rendering and getting lines to draw crisply</A>.&nbsp;</P>
<BLOCKQUOTE>
<P><EM>Note this also means when doing WPF-&gt;Win32 interop, you need to translate back to the device coordinate system.&nbsp; E.g.&nbsp;a WPF button that's set to Width=75, Height=23 is set to 75x23 DIU, not 75x23 pixels.&nbsp; To translate back you can use&nbsp;<A href="https://msdn.microsoft.com/en-us/library/system.windows.media.visual.pointtoscreen.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.windows.media.visual.pointtoscreen.aspx">Visual.PointToScreen</A> or&nbsp; </EM><A href="https://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.transformtodevice.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.transformtodevice.aspx"><EM>PresentationSource.FromDependencyObject(dobj).CompositionTarget.TransformToDevice</EM></A><EM>.&nbsp; </EM></P></BLOCKQUOTE>
<P>In either system, if you have bitmap artwork in your application, you may want to consider whether or not you want to use a separate larger image for this mode - as in high DPI, the image will be stretched larger.</P>
<P>If I have any more specific tips, I will be sure to post them!</P>]]></content:encoded>
    </item>
    <item>
      <title>bugviewer</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/bugviewer</link>
      <pubDate>Thu, 01 Oct 2009 00:20:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/10/01/bugviewer/</guid>
      <description><![CDATA[bugviewer
BugViewer.png]]></description>
      <content:encoded><![CDATA[bugviewer
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/90/16/50/BugViewer.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-90-16-50/BugViewer.png">BugViewer.png</a></p>]]></content:encoded>
    </item>
    <item>
      <title>bugviewer image</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/bugviewer-image</link>
      <pubDate>Thu, 01 Oct 2009 00:20:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/10/01/bugviewer-image/</guid>
      <description><![CDATA[bugviewer
BugViewer.png]]></description>
      <content:encoded><![CDATA[bugviewer
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/90/16/51/BugViewer.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-90-16-51/BugViewer.png">BugViewer.png</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Creating a bug repro viewer in 5 minutes</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/creating-a-bug-repro-viewer-in-5-minutes</link>
      <pubDate>Thu, 01 Oct 2009 00:06:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/10/01/creating-a-bug-repro-viewer-in-5-minutes/</guid>
      <description><![CDATA[One of my favorite books of all time is The Pragmatic Programmer.&nbsp; A piece of advice I've...]]></description>
      <content:encoded><![CDATA[<P>One of my favorite books of all time is <A href="https://en.wikipedia.org/wiki/The_Pragmatic_Programmer" mce_href="https://en.wikipedia.org/wiki/The_Pragmatic_Programmer">The Pragmatic Programmer</A>.&nbsp; A piece of advice I've always taken to heart is to take the time to make tools that will make you more productive.&nbsp;</P>
<P>Today's tool I can share with you - I didn't want to flip back and forth between&nbsp;the repro steps in my&nbsp;bug reporting program and the program I was trying to fix.&nbsp; </P>
<P>So I created a TopMost window that will always be there so I can see what the next step is.&nbsp; </P>
<UL>
<LI>Open Visual Studio 2008 or 2005, create a new Windows Forms application.</LI>
<LI>Select the Form in the designer</LI>
<LI>Open the Property Grid and find the TopMost property.&nbsp; Set TopMost=true.</LI>
<LI>Drag and drop a RichTextBox from the toolbox</LI>
<LI>Select "Dock in parent container" from the designer action panel, or go to the property grid and choose Dock=Fill</LI>
<LI>F5 to run the application</LI>
<LI>Paste in repro steps from the bug!&nbsp; </LI>
<UL>
<LI><EM>(Tip - if the steps are in HTML, you may want to paste into word first, then the rich text box to get better formatting).</EM></LI></UL></UL>
<P>&nbsp;And voila!</P>
<P mce_keep="true">
<UL><IMG src="https://blogs.msdn.com/jfoscoding/attachment/9901650.ashx" mce_src="https://blogs.msdn.com/jfoscoding/attachment/9901650.ashx"><BR><SMALL>Quick and simple repro-step viewer that stays on top of all applications.</SMALL></UL>]]></content:encoded>
    </item>
    <item>
      <title>OnRenderVersusOnPaint</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/onrenderversusonpaint</link>
      <pubDate>Thu, 10 Sep 2009 01:00:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/09/10/onrenderversusonpaint/</guid>
      <description><![CDATA[OnRenderVersusOnPaint
OnRenderVersusOnPaint2.png]]></description>
      <content:encoded><![CDATA[OnRenderVersusOnPaint
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/89/34/68/OnRenderVersusOnPaint2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-89-34-68/OnRenderVersusOnPaint2.png">OnRenderVersusOnPaint2.png</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Tip: creating your own snippets</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/tip-creating-your-own-snippets</link>
      <pubDate>Tue, 08 Sep 2009 02:14:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/09/08/tip-creating-your-own-snippets/</guid>
      <description><![CDATA[I recently showed how to use the&nbsp;"Define a Dependency Property" snippet in VS to save...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>I recently showed how to use the&nbsp;"Define a Dependency Property" snippet in VS to save time/frustration&nbsp;creating a new property&nbsp;on your control.&nbsp; I often need&nbsp;a property changed event as well, and it's a bit of a pain to go back and add it.&nbsp; I just figured out how to add/update snippets and thought I'd show you how to create a snippet with a property changed event:</FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">int</SPAN> MyProperty {<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> (<SPAN style="COLOR: blue">int</SPAN>)GetValue(MyPropertyProperty); }<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">set</SPAN> { SetValue(MyPropertyProperty, <SPAN style="COLOR: blue">value</SPAN>); }<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Using a DependencyProperty as the backing store for MyProperty.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This enables animation, styling, binding, etc...<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">readonly</SPAN> <SPAN style="COLOR: #2b91af">DependencyProperty</SPAN> MyPropertyProperty =<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">DependencyProperty</SPAN>.Register(<SPAN style="COLOR: #a31515">"MyProperty"</SPAN>, <SPAN style="COLOR: blue">typeof</SPAN>(<SPAN style="COLOR: blue">int</SPAN>), <SPAN style="COLOR: blue">typeof</SPAN>(<SPAN style="COLOR: #2b91af">Window1</SPAN>), <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">UIPropertyMetadata</SPAN>(0, OnMyPropertyChanged));<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> OnMyPropertyChanged(<SPAN style="COLOR: #2b91af">DependencyObject</SPAN> dobj, <SPAN style="COLOR: #2b91af">DependencyPropertyChangedEventArgs</SPAN> e) {<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Window1</SPAN> owner = dobj <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">Window1</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (owner != <SPAN style="COLOR: blue">null</SPAN>) {<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// todo: execute property changed code.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 7pt; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P><FONT size=3 face=Calibri>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><FONT size=3 face=Calibri>If you have a spare few minutes, it is very easy to add this – you need to use the <A href="https://msdn.microsoft.com/en-us/library/9ybhaktf.aspx"><FONT size=3 face=Calibri>Code Snippet Manager</FONT></A><FONT size=3 face=Calibri>.</FONT></FONT></P></FONT>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri><A href="https://blogs.msdn.com/jfoscoding/attachment/9892408.ashx" mce_href="https://blogs.msdn.com/jfoscoding/attachment/9892408.ashx">Save this snippet to your disk</A> as somefile.snippet (<A href="https://blogs.msdn.com/jfoscoding/pages/dp-property-changed-snippet.aspx" mce_href="https://blogs.msdn.com/jfoscoding/pages/dp-property-changed-snippet.aspx">view source</A>)<BR>In VS 2008, open Tools &gt; Code Snippets Manager<BR>Choose the language (this is a C# snippet) <BR>Choose import...<BR>Find the .snippet file, import it, and voila!</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Tip: quickly create a dependency property</title>
      <link>https://docs.microsoft.com/archive/blogs/jfoscoding/tip-quickly-create-a-dependency-property</link>
      <pubDate>Tue, 08 Sep 2009 02:11:00 GMT</pubDate>
      <dc:creator><![CDATA[jfoscoding]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jfoscoding/2009/09/08/tip-quickly-create-a-dependency-property/</guid>
      <description><![CDATA[If you want to make a property&nbsp;that can be styled from XAML&nbsp;- you need to create a...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>If you want to make a property&nbsp;that can be styled from XAML&nbsp;- you need to create a dependency property on your control.&nbsp; This can be a tricky syntax, but fortunately the C#/VB editor have "snippets" that allow you to really quickly create one.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>Let’s assume we’re creating a BorderVisibility property on a UserControl.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>It defaults to Visibility.Hidden.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>Right click on the code editor.<BR>Choose “Insert Snippet ...”<BR>Choose NetFX30&gt;Define a Dependency Property</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Tab through and replace the fields in green.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri><IMG src="https://blogs.msdn.com/jfoscoding/attachment/9892411.ashx" mce_src="https://blogs.msdn.com/jfoscoding/attachment/9892411.ashx"></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Replace the following:<SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">int</SPAN><FONT face=Calibri><SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"> </SPAN><FONT size=3>with our return type: </FONT></FONT><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">Visibility<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">ownerclass </SPAN><FONT size=3 face=Calibri>with the class that defines the property, e.g. </FONT><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">UserControl1<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">0 </SPAN><FONT size=3 face=Calibri>with the default value for the property </FONT><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">Visibility.Hidden<o:p></o:p></SPAN></P>]]></content:encoded>
    </item>
  </channel>
</rss>