DanRigby.comDanRigby.comhttps://www.danrigby.com/2018-11-20T12:10:56-05:00Dan Rigbyhttps://www.danrigby.comSandra.Snow Atom Generatorhttps://www.danrigby.com/2018/08/30/app-service-installed-dotnet-functions-versions/How to determine the installed .NET Framework, .NET Core, and Functions Runtime versions in Azure App Services<p>I was looking to see which versions of the .NET Framework, .NET Core, and the Functions Runtime were installed in <a href="https://azure.microsoft.com/en-us/services/app-service/">Azure App Service</a> and came across <a href="https://blogs.msdn.microsoft.com/waws/2016/11/02/how-to-determine-the-installed-net-version-in-azure-app-services/">Jeff Sanders' post from 2016</a> on the topic but it was missing details for .NET Core and Functions, so I decided to write up a single post that covers all three.</p>
<h2>First steps</h2>
<p>The first thing we need to do is to open the <a href="https://github.com/projectkudu/kudu/wiki/Kudu-console">Kudu Debug Console</a>.</p>
<p>To do that, navigate to <code>{yoursite}.scm.azurewebsites.net</code> and then click on "Debug console" at the top. You can select either CMD or PowerShell.</p>
<p><img src="https://www.danrigby.com/images/app-service-kudu-debug-console.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>Now that we have the console open...</p>
<h2>.NET Framework</h2>
<p>To find out the installed .NET Framework versions, type: <code>ls "\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-framework.png" alt="Opening the HTTP Trigger Settings" /></p>
<p><code>ls -l</code> and <code>dir</code> also work in place of <code>ls</code>, we're just listing the contents of the folder.</p>
<h2>.NET Core</h2>
<p>For .NET Core, you have two options:</p>
<p>You can use the <code>dotnet --info</code> command</p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-core-info.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>Or you can type: <code>ls "\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-core-folder.png" alt="Opening the HTTP Trigger Settings" /></p>
<h2>Functions Runtime</h2>
<p>For the installed Azure Functions Runtime versions, type: <code>ls "\Program Files (x86)\SiteExtensions\Functions"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-functions-runtime.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>The Kudu console supports pasting via Control-V for the commands above.</p>
<p>You can also select the "System Drive" icon in the file browser section at the top of the page and then navigate to the respective folders by clicking the folder links. Using the file browser will automatically change the current working directory in the console.</p>
<p><img src="https://www.danrigby.com/images/app-service-kudu-console-system-drive.png" alt="Opening the HTTP Trigger Settings" /></p>
2018-08-30T04:00:00Z2018-08-30T04:00:00ZDan Rigby<p>I was looking to see which versions of the .NET Framework, .NET Core, and the Functions Runtime were installed in <a href="https://azure.microsoft.com/en-us/services/app-service/">Azure App Service</a> and came across <a href="https://blogs.msdn.microsoft.com/waws/2016/11/02/how-to-determine-the-installed-net-version-in-azure-app-services/">Jeff Sanders' post from 2016</a> on the topic but it was missing details for .NET Core and Functions, so I decided to write up a single post that covers all three.</p>
<h2>First steps</h2>
<p>The first thing we need to do is to open the <a href="https://github.com/projectkudu/kudu/wiki/Kudu-console">Kudu Debug Console</a>.</p>
<p>To do that, navigate to <code>{yoursite}.scm.azurewebsites.net</code> and then click on "Debug console" at the top. You can select either CMD or PowerShell.</p>
<p><img src="https://www.danrigby.com/images/app-service-kudu-debug-console.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>Now that we have the console open...</p>
<h2>.NET Framework</h2>
<p>To find out the installed .NET Framework versions, type: <code>ls "\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-framework.png" alt="Opening the HTTP Trigger Settings" /></p>
<p><code>ls -l</code> and <code>dir</code> also work in place of <code>ls</code>, we're just listing the contents of the folder.</p>
<h2>.NET Core</h2>
<p>For .NET Core, you have two options:</p>
<p>You can use the <code>dotnet --info</code> command</p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-core-info.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>Or you can type: <code>ls "\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-net-core-folder.png" alt="Opening the HTTP Trigger Settings" /></p>
<h2>Functions Runtime</h2>
<p>For the installed Azure Functions Runtime versions, type: <code>ls "\Program Files (x86)\SiteExtensions\Functions"</code></p>
<p><img src="https://www.danrigby.com/images/app-service-installed-functions-runtime.png" alt="Opening the HTTP Trigger Settings" /></p>
<p>The Kudu console supports pasting via Control-V for the commands above.</p>
<p>You can also select the "System Drive" icon in the file browser section at the top of the page and then navigate to the respective folders by clicking the folder links. Using the file browser will automatically change the current working directory in the console.</p>
<p><img src="https://www.danrigby.com/images/app-service-kudu-console-system-drive.png" alt="Opening the HTTP Trigger Settings" /></p>
https://www.danrigby.com/2018/08/27/enable-schema-validation-and-required-fields-in-logicapps/Enable Schema Validation and Required Fields for JSON in Azure Logic Apps<p>Logic Apps is pretty accommodating about the format of the json you supply to an <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers#http-trigger">HTTP trigger</a> and doesn't by default warn you when it doesn't match the schema you've specified.</p>
<p>Here's how to enable schema validation and additionally specify required properties in that <a href="https://json-schema.org/">json schema</a> to help you more easily catch issues in your input data.</p>
<ul>
<li>Open the settings for the HTTP Trigger (click the ellipsis to open the menu):</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-designer.png" alt="Opening the HTTP Trigger Settings" /></p>
<ul>
<li>Toggle on Schema Validation (it's off by default):</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-settings.png" alt="Enabling Schema Validation" /></p>
<ul>
<li>Add a <a href="https://json-schema.org/understanding-json-schema/reference/object.html#required">"required" array</a> after the property definition segment of the json schema and specify which properties should always be present in the json input:</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-json-required-properties.png" alt="Setting Required JSON Properties" /></p>
<p>By default json properties are treated as nullable, so it's the combination of enabling schema validation and specifying the required values that can quickly help you pinpoint issues with input data that isn't formatted like you're expecting.</p>
<p>The required properties setting can be used on any action that lets you specify the schema of the JSON you're working with, a good example being the <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers#parse-json-action">Parse JSON action</a>.</p>
<p>If you're unfamiliar with how to create a JSON Schema for use in Logic Apps, you can create one quickly using the <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type#create-tokens-for-json-properties">"Use sample payload to generate schema"</a> link on the Logic Apps actions that accept JSON input, but for a more in depth walk through, Michael Crump has a good post here: <a href="https://www.michaelcrump.net/azure-tips-and-tricks38/">https://www.michaelcrump.net/azure-tips-and-tricks38/</a></p>
2018-08-27T04:00:00Z2018-08-27T04:00:00ZDan Rigby<p>Logic Apps is pretty accommodating about the format of the json you supply to an <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers#http-trigger">HTTP trigger</a> and doesn't by default warn you when it doesn't match the schema you've specified.</p>
<p>Here's how to enable schema validation and additionally specify required properties in that <a href="https://json-schema.org/">json schema</a> to help you more easily catch issues in your input data.</p>
<ul>
<li>Open the settings for the HTTP Trigger (click the ellipsis to open the menu):</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-designer.png" alt="Opening the HTTP Trigger Settings" /></p>
<ul>
<li>Toggle on Schema Validation (it's off by default):</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-settings.png" alt="Enabling Schema Validation" /></p>
<ul>
<li>Add a <a href="https://json-schema.org/understanding-json-schema/reference/object.html#required">"required" array</a> after the property definition segment of the json schema and specify which properties should always be present in the json input:</li>
</ul>
<p><img src="https://www.danrigby.com/images/logicapps-http-request-json-required-properties.png" alt="Setting Required JSON Properties" /></p>
<p>By default json properties are treated as nullable, so it's the combination of enabling schema validation and specifying the required values that can quickly help you pinpoint issues with input data that isn't formatted like you're expecting.</p>
<p>The required properties setting can be used on any action that lets you specify the schema of the JSON you're working with, a good example being the <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers#parse-json-action">Parse JSON action</a>.</p>
<p>If you're unfamiliar with how to create a JSON Schema for use in Logic Apps, you can create one quickly using the <a href="https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type#create-tokens-for-json-properties">"Use sample payload to generate schema"</a> link on the Logic Apps actions that accept JSON input, but for a more in depth walk through, Michael Crump has a good post here: <a href="https://www.michaelcrump.net/azure-tips-and-tricks38/">https://www.michaelcrump.net/azure-tips-and-tricks38/</a></p>
https://www.danrigby.com/2016/11/29/xamarin-university-resources/Free Xamarin University Resources<p><a href="https://www.xamarin.com/university">Xamarin University</a> offers a wealth of training materials across a broad range of subjects with live instructor led courses, self guided training, guest lectures, and more.</p>
<p>Many of the introductory materials are available for free or included with other programs and I wanted to capture links to them here so people can get started even if they're not yet ready to pull the trigger on a full Xamarin University subscription.</p>
<hr>
<h1>Self-Guided Lessons & Free Trial</h1>
<p>You can access many self-guided lessons from Xamarin University for free by visiting <a href="https://university.xamarin.com/self-guided">https://university.xamarin.com/self-guided</a> and creating a Xamarin account (or signing in with an existing one).</p>
<p>These self-guided lessons include videos, exercises, quizzes, and earn you credit towards becoming a <a href="https://university.xamarin.com/resources/certification">Xamarin Certified mobile developer</a>.</p>
<p>If this is your first time signing in to Xamarin University, this will also start a free trial that includes 30 days of access to Xamarin University's <a href="https://university.xamarin.com/guestlectures">Guest Lectures</a> and two live instructor led courses in addition to the self-guided lessons.</p>
<hr>
<h1>Dev Essentials & Visual Studio Subscribers</h1>
<p>If you are a <a href="https://www.visualstudio.com/dev-essentials/">Visual Studio Dev Essentials</a> program member or <a href="https://www.visualstudio.com/subscriptions/">Visual Studio subscriber</a> (formerly MSDN), you have access to additional course content in Xamarin University above and beyond the self guided lessons.</p>
<p>Visit the <a href="https://my.visualstudio.com/">My Visual Studio portal</a> and log in to activate your Xamarin University benefits.</p>
<hr>
<h1>On-Demand Videos</h1>
<h2>Lightning Lectures</h2>
<p>Xamarin University's <a href="https://university.xamarin.com/lightninglectures">Lightning Lectures</a> are available for anyone to watch without a Xamarin account and are short, focused sessions that cover a variety of common challenges, tools, and topics around mobile development.</p>
<h2>Connect(); // 2016</h2>
<p>As part of the Connect(); //2016 event, six on demand videos were published by Xamarin University. These videos are available on <a href="https://university.xamarin.com/connect2016">Xamarin University</a>, <a href="https://channel9.msdn.com/">Channel 9</a>, and <a href="https://www.youtube.com/VisualStudio">YouTube</a>.</p>
<p>The training materials for these sessions can be found on <a href="https://github.com/xamarin/xamarinu-connect2016">GitHub</a>.</p>
<h3>Module #1 - Introduction to Xamarin Platform (Rob Gibbens)</h3>
<p>This session provides a quick introduction to the Xamarin tools for Visual Studio. It will show you what you need to develop, debug, deploy and publish applications for iOS and Android using Visual Studio 2015 or Visual Studio 2017 RC with the Xamarin tools installed.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-1">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=bp5eBEIhya8">Watch on YouTube</a></p>
<h3>Module #2 - Introduction to Xamarin.Forms (Renè Ruppert)</h3>
<p>In this session, we will dive into Xamarin.Forms, a cross-platform UI framework that allows you to create native UIs for iOS, Android and Windows with shared code. By the end of this session, you will have a good understanding of how Xamarin.Forms works, how to design basic pages, and how to share code with Portal Class Libraries or Shared Projects. Finally, we will begin a new project – a Trivia app, which will be completed throughout the remainder of the sessions.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-2">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=rbvfRcwcrsk">Watch on YouTube</a></p>
<h3>Module #3 - XAML Fundamentals (Jesse Dietrichson)</h3>
<p>Xamarin.Forms supports the use of the XAML markup language to design your UI. In this session, we will cover the basics of the XAML language, design a few more screens for our trivia application, and explore some best practices when using XAML with your mobile applications and Xamarin.Forms.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-3">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=KhsdzYmokyM">Watch on YouTube</a></p>
<h3>Module #4 - Adding Azure Web Services (Jason DeBoever)</h3>
<p>Now that the main pieces of the trivia application are in place, we will explore adding a server backend to our mobile application using Azure App services. This session will show you how quick and easy it is to add a cloud-based database which is synchronized to your application, allowing you to change the data that drives your application without publishing a new version of the application each time.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-4">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=HsKjJ6ohjSA">Watch on YouTube</a></p>
<h3>Module #5 - UITesting (Glenn Stephens)</h3>
<p>We all know that we need to test our applications thoroughly to ensure quality – and this is particularly important in the mobile world where a few bad reviews can kill your sales on the various app stores! In this session, we will test our trivia application using Xamarin.UITest and Xamarin TestCloud. These tools allow you to define the behavior of your application and then automate the application on simulators and physical devices to validate the expected behavior. To ensure we try our app on every possible variation, we will push our tests up to the cloud where we can run it across hundreds of real devices and get back a comprehensive report of any failures.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-5">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=gUpPTq7zBq8">Watch on YouTube</a></p>
<h3>Module #6 - Distributing your application and collecting information (Kym Phillpotts)</h3>
<p>In this final session, we will get ready to distribute our trivia application to the world – starting with some beta testers. We will look at two different systems – first, HockeyApp which allows us to monitor and collect runtime analytics from our application as it runs on all our beta testers devices. Then, we will take a quick look at Visual Studio Mobile Center, announced at Connect(); which brings a lot of the mobile platform systems we looked at over the course of the day together.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-6">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=F3qneygBaEk">Watch on YouTube</a></p>
<hr>
<h1>Full Subscriptions</h1>
<p>Once you're ready, you can purchase a full subscription to Xamarin University that includes unlimited live online instructor led training, 1-on-1 office hours with instructors, unlimited access to recorded class videos, self-guided lessons, class labs and training materials, and the Xamarin certification exam.</p>
<p>The complete course catalog contains <a href="https://university.xamarin.com/classes">over 70 classes</a> across 8 different tracks ranging from beginner level C# to advanced enterprise security in mobile applications.</p>
<p>Visit <a href="https://www.xamarin.com/university">https://www.xamarin.com/university</a> for more information on purchasing.</p>
2016-11-29T05:00:00Z2016-11-29T05:00:00ZDan Rigby<p><a href="https://www.xamarin.com/university">Xamarin University</a> offers a wealth of training materials across a broad range of subjects with live instructor led courses, self guided training, guest lectures, and more.</p>
<p>Many of the introductory materials are available for free or included with other programs and I wanted to capture links to them here so people can get started even if they're not yet ready to pull the trigger on a full Xamarin University subscription.</p>
<hr>
<h1>Self-Guided Lessons & Free Trial</h1>
<p>You can access many self-guided lessons from Xamarin University for free by visiting <a href="https://university.xamarin.com/self-guided">https://university.xamarin.com/self-guided</a> and creating a Xamarin account (or signing in with an existing one).</p>
<p>These self-guided lessons include videos, exercises, quizzes, and earn you credit towards becoming a <a href="https://university.xamarin.com/resources/certification">Xamarin Certified mobile developer</a>.</p>
<p>If this is your first time signing in to Xamarin University, this will also start a free trial that includes 30 days of access to Xamarin University's <a href="https://university.xamarin.com/guestlectures">Guest Lectures</a> and two live instructor led courses in addition to the self-guided lessons.</p>
<hr>
<h1>Dev Essentials & Visual Studio Subscribers</h1>
<p>If you are a <a href="https://www.visualstudio.com/dev-essentials/">Visual Studio Dev Essentials</a> program member or <a href="https://www.visualstudio.com/subscriptions/">Visual Studio subscriber</a> (formerly MSDN), you have access to additional course content in Xamarin University above and beyond the self guided lessons.</p>
<p>Visit the <a href="https://my.visualstudio.com/">My Visual Studio portal</a> and log in to activate your Xamarin University benefits.</p>
<hr>
<h1>On-Demand Videos</h1>
<h2>Lightning Lectures</h2>
<p>Xamarin University's <a href="https://university.xamarin.com/lightninglectures">Lightning Lectures</a> are available for anyone to watch without a Xamarin account and are short, focused sessions that cover a variety of common challenges, tools, and topics around mobile development.</p>
<h2>Connect(); // 2016</h2>
<p>As part of the Connect(); //2016 event, six on demand videos were published by Xamarin University. These videos are available on <a href="https://university.xamarin.com/connect2016">Xamarin University</a>, <a href="https://channel9.msdn.com/">Channel 9</a>, and <a href="https://www.youtube.com/VisualStudio">YouTube</a>.</p>
<p>The training materials for these sessions can be found on <a href="https://github.com/xamarin/xamarinu-connect2016">GitHub</a>.</p>
<h3>Module #1 - Introduction to Xamarin Platform (Rob Gibbens)</h3>
<p>This session provides a quick introduction to the Xamarin tools for Visual Studio. It will show you what you need to develop, debug, deploy and publish applications for iOS and Android using Visual Studio 2015 or Visual Studio 2017 RC with the Xamarin tools installed.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-1">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=bp5eBEIhya8">Watch on YouTube</a></p>
<h3>Module #2 - Introduction to Xamarin.Forms (Renè Ruppert)</h3>
<p>In this session, we will dive into Xamarin.Forms, a cross-platform UI framework that allows you to create native UIs for iOS, Android and Windows with shared code. By the end of this session, you will have a good understanding of how Xamarin.Forms works, how to design basic pages, and how to share code with Portal Class Libraries or Shared Projects. Finally, we will begin a new project – a Trivia app, which will be completed throughout the remainder of the sessions.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-2">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=rbvfRcwcrsk">Watch on YouTube</a></p>
<h3>Module #3 - XAML Fundamentals (Jesse Dietrichson)</h3>
<p>Xamarin.Forms supports the use of the XAML markup language to design your UI. In this session, we will cover the basics of the XAML language, design a few more screens for our trivia application, and explore some best practices when using XAML with your mobile applications and Xamarin.Forms.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-3">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=KhsdzYmokyM">Watch on YouTube</a></p>
<h3>Module #4 - Adding Azure Web Services (Jason DeBoever)</h3>
<p>Now that the main pieces of the trivia application are in place, we will explore adding a server backend to our mobile application using Azure App services. This session will show you how quick and easy it is to add a cloud-based database which is synchronized to your application, allowing you to change the data that drives your application without publishing a new version of the application each time.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-4">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=HsKjJ6ohjSA">Watch on YouTube</a></p>
<h3>Module #5 - UITesting (Glenn Stephens)</h3>
<p>We all know that we need to test our applications thoroughly to ensure quality – and this is particularly important in the mobile world where a few bad reviews can kill your sales on the various app stores! In this session, we will test our trivia application using Xamarin.UITest and Xamarin TestCloud. These tools allow you to define the behavior of your application and then automate the application on simulators and physical devices to validate the expected behavior. To ensure we try our app on every possible variation, we will push our tests up to the cloud where we can run it across hundreds of real devices and get back a comprehensive report of any failures.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-5">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=gUpPTq7zBq8">Watch on YouTube</a></p>
<h3>Module #6 - Distributing your application and collecting information (Kym Phillpotts)</h3>
<p>In this final session, we will get ready to distribute our trivia application to the world – starting with some beta testers. We will look at two different systems – first, HockeyApp which allows us to monitor and collect runtime analytics from our application as it runs on all our beta testers devices. Then, we will take a quick look at Visual Studio Mobile Center, announced at Connect(); which brings a lot of the mobile platform systems we looked at over the course of the day together.</p>
<p><a href="https://channel9.msdn.com/Events/Connect/2016/Xamarin101-6">Watch on Channel 9</a> | <a href="https://www.youtube.com/watch?v=F3qneygBaEk">Watch on YouTube</a></p>
<hr>
<h1>Full Subscriptions</h1>
<p>Once you're ready, you can purchase a full subscription to Xamarin University that includes unlimited live online instructor led training, 1-on-1 office hours with instructors, unlimited access to recorded class videos, self-guided lessons, class labs and training materials, and the Xamarin certification exam.</p>
<p>The complete course catalog contains <a href="https://university.xamarin.com/classes">over 70 classes</a> across 8 different tracks ranging from beginner level C# to advanced enterprise security in mobile applications.</p>
<p>Visit <a href="https://www.xamarin.com/university">https://www.xamarin.com/university</a> for more information on purchasing.</p>
https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/INotifyPropertyChanged, The .NET 4.6 Way<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li>INotifyPropertyChanged, The .NET 4.6 Way</li>
</ol>
<hr />
<p>With the release of <a href="https://msdn.microsoft.com/en-us/library/dd831853">Visual Studio 2015</a> & <a href="https://msdn.microsoft.com/en-us/library/w0x726c2">.NET 4.6</a>, we have a new version of the C# compiler and along with it a new version of C# [version 6] that includes new language features that we can leverage to improve the implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged"><code>INotifyPropertyChanged</code></a> in our applications.</p>
<p>Specifically, with the addition of the <a href="https://msdn.microsoft.com/en-us/library/dn986595">Null-conditional Operators</a> in C# 6, we can simplify the implementation of our <code>OnPropertyChanged</code> method from:</p>
<pre><code>protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
</code></pre>
<p>to:</p>
<pre><code>protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
</code></pre>
<p>This works because the new Null-conditional Operators are <a href="https://msdn.microsoft.com/en-us/library/dn986595">thread-safe</a>:</p>
<blockquote>Another use for the null-condition member access is invoking delegates in a thread-safe way with much less code.
...
The new way is thread-safe because the compiler generates code to evaluate PropertyChanged one time only, keeping the result in a temporary variable.</blockquote>
<p>While the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute"><code>CallerMemberName</code></a> attribute in our <code>OnPropertyChanged</code> method implementation will handle most cases, when we do need to manually specify the name of a property in C# 6, we no longer need to resort to the use of magic strings or expression trees. Rather, we can now use the new <a href="https://msdn.microsoft.com/en-us/library/dn986596"><code>nameof()</code></a> operator keyword to pass the property name:
</p>
<pre><code>OnPropertyChanged(nameof(MyProperty));
</code></pre>
<p>These changes have the added bonus of being usable when you're targeting prior versions of .NET as well (though you must have the .NET 4.6 tooling installed). <strong>This means we don't have to update our existing applications and libraries to .NET 4.6 just the take advantage of the new language features.</strong></p>
<p>The code in this post, except for the <code>CallerMemberName</code> attribute, works in Visual Studio 2015 when targeting framework versions all the way down to .NET 2.0. The use of the <code>CallerMemberName</code> attribute requires a target of .NET 4.5 or higher.</p>
<p>Using these features, our implementation of the BindableBase class now looks like this:</p>
<pre><code>using System.ComponentModel;
using System.Runtime.CompilerServices;
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged" /> to simplify models.
/// </summary>
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.
/// </param>
/// <returns>
/// True if the value was changed, false if the existing value matched the
/// desired value.
/// </returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value))
{
return false;
}
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute" />.
/// </param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
</code></pre>
<p><a href="https://msdn.microsoft.com/en-us/library/dn986595">Null-conditional Operators</a> and the <a href="https://msdn.microsoft.com/en-us/library/dn986596"><code>nameof()</code></a> operator are both fantastic new additions. While you're taking advantage of them, don't forget to familiarize yourself with all of the <a href="https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6">new language features in C# 6</a>.</p>
<p><strong>Bonus:</strong> If you wanted to implement BindableBase while targeting .NET 2.0 to .NET 4.0, it would <a href="https://gist.github.com/DanRigby/98fd60dd32df82a678cd">look like this</a>.</p>
2015-09-12T04:00:00Z2015-09-12T04:00:00ZDan Rigby<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li>INotifyPropertyChanged, The .NET 4.6 Way</li>
</ol>
<hr />
<p>With the release of <a href="https://msdn.microsoft.com/en-us/library/dd831853">Visual Studio 2015</a> & <a href="https://msdn.microsoft.com/en-us/library/w0x726c2">.NET 4.6</a>, we have a new version of the C# compiler and along with it a new version of C# [version 6] that includes new language features that we can leverage to improve the implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged"><code>INotifyPropertyChanged</code></a> in our applications.</p>
<p>Specifically, with the addition of the <a href="https://msdn.microsoft.com/en-us/library/dn986595">Null-conditional Operators</a> in C# 6, we can simplify the implementation of our <code>OnPropertyChanged</code> method from:</p>
<pre><code>protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
</code></pre>
<p>to:</p>
<pre><code>protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
</code></pre>
<p>This works because the new Null-conditional Operators are <a href="https://msdn.microsoft.com/en-us/library/dn986595">thread-safe</a>:</p>
<blockquote>Another use for the null-condition member access is invoking delegates in a thread-safe way with much less code.
...
The new way is thread-safe because the compiler generates code to evaluate PropertyChanged one time only, keeping the result in a temporary variable.</blockquote>
<p>While the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute"><code>CallerMemberName</code></a> attribute in our <code>OnPropertyChanged</code> method implementation will handle most cases, when we do need to manually specify the name of a property in C# 6, we no longer need to resort to the use of magic strings or expression trees. Rather, we can now use the new <a href="https://msdn.microsoft.com/en-us/library/dn986596"><code>nameof()</code></a> operator keyword to pass the property name:
</p>
<pre><code>OnPropertyChanged(nameof(MyProperty));
</code></pre>
<p>These changes have the added bonus of being usable when you're targeting prior versions of .NET as well (though you must have the .NET 4.6 tooling installed). <strong>This means we don't have to update our existing applications and libraries to .NET 4.6 just the take advantage of the new language features.</strong></p>
<p>The code in this post, except for the <code>CallerMemberName</code> attribute, works in Visual Studio 2015 when targeting framework versions all the way down to .NET 2.0. The use of the <code>CallerMemberName</code> attribute requires a target of .NET 4.5 or higher.</p>
<p>Using these features, our implementation of the BindableBase class now looks like this:</p>
<pre><code>using System.ComponentModel;
using System.Runtime.CompilerServices;
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged" /> to simplify models.
/// </summary>
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.
/// </param>
/// <returns>
/// True if the value was changed, false if the existing value matched the
/// desired value.
/// </returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value))
{
return false;
}
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute" />.
/// </param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
</code></pre>
<p><a href="https://msdn.microsoft.com/en-us/library/dn986595">Null-conditional Operators</a> and the <a href="https://msdn.microsoft.com/en-us/library/dn986596"><code>nameof()</code></a> operator are both fantastic new additions. While you're taking advantage of them, don't forget to familiarize yourself with all of the <a href="https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6">new language features in C# 6</a>.</p>
<p><strong>Bonus:</strong> If you wanted to implement BindableBase while targeting .NET 2.0 to .NET 4.0, it would <a href="https://gist.github.com/DanRigby/98fd60dd32df82a678cd">look like this</a>.</p>
https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/Supported PCL Profiles in Xamarin for Visual Studio<p><strong>2016/06/09 Update:</strong></p>
<p>As of the <a href="https://developer.xamarin.com/releases/vs/xamarin.vs_4/xamarin.vs_4.1/">Xamarin 4.1 release</a> two new profiles were added:</p>
<pre><code>Profile 44 (.NET Framework 4.5.1, Windows 8.1) (netstandard 1.2)
Profile 151 (.NET Framework 4.5.1, Windows 8.1, Windows Phone 8.1) (netstandard 1.2)
</code></pre>
<p>My <a href="https://www.danrigby.com/2014/04/16/xamarin-pcl-profile-notes/">Profile Notes page</a> has been updated with the details of these new profiles.</p>
<p><strong>Original Post:</strong></p>
<p>Xamarin is continuing their rapid development pace and has released several updates to their Xamarin for Visual Studio tools since my last post on <a href="https://www.danrigby.com/2014/04/16/xamarin-pcl-profile-notes/">PCL Profiles & Xamarin</a>.</p>
<p>Most notably, if you're on the <strong>Alpha</strong> or <strong>Beta</strong> channel, they have released a 2.0 build of <strong>Xamarin for Visual Studio</strong> which unifies the iOS and Android installers into a single package and adds support for several new PCL profiles.</p>
<h3>Here are all of the currently supported PCL profiles in the 2.0 release (No <a href="https://www.danrigby.com/2014/04/10/windowsphone81-pcl-xamarin-fix/">SupportedFramework Fix</a> required):</h3>
<pre><code>Profile 5 (.NET Framework 4, Windows 8)
Profile 6 (.NET Framework 4.0.3, Windows 8)
Profile 7 (.NET Framework 4.5, Windows 8) (netstandard 1.1)
Profile 14 (.NET Framework 4, Silverlight 5)
Profile 19 (.NET Framework 4.0.3, Silverlight 5)
Profile 24 (.NET Framework 4.5, Silverlight 5)
Profile 37 (.NET Framework 4, Silverlight 5, Windows 8)
Profile 42 (.NET Framework 4.0.3, Silverlight 5, Windows 8)
Profile 47 (.NET Framework 4.5, Silverlight 5, Windows 8)
Profile 49 (.NET Framework 4.5, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 78 (.NET Framework 4.5, Windows 8, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 92 (.NET Framework 4, Windows 8, Windows Phone 8.1)
Profile 102 (.NET Framework 4.0.3, Windows 8, Windows Phone 8.1)
Profile 111 (.NET Framework 4.5, Windows 8, Windows Phone 8.1) (netstandard 1.1)
Profile 136 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 147 (.NET Framework 4.0.3, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 158 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 225 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1)
Profile 255 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone 8.1)
Profile 259 (.NET Framework 4.5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
Profile 328 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 336 (.NET Framework 4.0.3, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
Profile 344 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
</code></pre>
<h3>Now what profile should you choose?</h3>
<p>My advice:</p>
<ul>
<li>If you're starting a brand new cross platform mobile .NET app today and looking to use a PCL for common code in your app, you should probably use <strong>Profile 111</strong> as it offers access to a lot of APIs not available in the other profiles.</li>
<li>If you're creating a library for consumption by a broad range of existing cross platform mobile .NET applications, you should look at <strong>Profile 259</strong> as it has broad reach and access to .NET 4.5 functionality.</li>
</ul>
<h4>If you're looking for a complete list of all PCL profiles, take a look at <a href="http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY">this great reference</a> created by <a href="http://blog.stephencleary.com">Stephen Cleary</a>.</h4>
2014-05-14T04:00:00Z2014-05-14T04:00:00ZDan Rigby<p><strong>2016/06/09 Update:</strong></p>
<p>As of the <a href="https://developer.xamarin.com/releases/vs/xamarin.vs_4/xamarin.vs_4.1/">Xamarin 4.1 release</a> two new profiles were added:</p>
<pre><code>Profile 44 (.NET Framework 4.5.1, Windows 8.1) (netstandard 1.2)
Profile 151 (.NET Framework 4.5.1, Windows 8.1, Windows Phone 8.1) (netstandard 1.2)
</code></pre>
<p>My <a href="https://www.danrigby.com/2014/04/16/xamarin-pcl-profile-notes/">Profile Notes page</a> has been updated with the details of these new profiles.</p>
<p><strong>Original Post:</strong></p>
<p>Xamarin is continuing their rapid development pace and has released several updates to their Xamarin for Visual Studio tools since my last post on <a href="https://www.danrigby.com/2014/04/16/xamarin-pcl-profile-notes/">PCL Profiles & Xamarin</a>.</p>
<p>Most notably, if you're on the <strong>Alpha</strong> or <strong>Beta</strong> channel, they have released a 2.0 build of <strong>Xamarin for Visual Studio</strong> which unifies the iOS and Android installers into a single package and adds support for several new PCL profiles.</p>
<h3>Here are all of the currently supported PCL profiles in the 2.0 release (No <a href="https://www.danrigby.com/2014/04/10/windowsphone81-pcl-xamarin-fix/">SupportedFramework Fix</a> required):</h3>
<pre><code>Profile 5 (.NET Framework 4, Windows 8)
Profile 6 (.NET Framework 4.0.3, Windows 8)
Profile 7 (.NET Framework 4.5, Windows 8) (netstandard 1.1)
Profile 14 (.NET Framework 4, Silverlight 5)
Profile 19 (.NET Framework 4.0.3, Silverlight 5)
Profile 24 (.NET Framework 4.5, Silverlight 5)
Profile 37 (.NET Framework 4, Silverlight 5, Windows 8)
Profile 42 (.NET Framework 4.0.3, Silverlight 5, Windows 8)
Profile 47 (.NET Framework 4.5, Silverlight 5, Windows 8)
Profile 49 (.NET Framework 4.5, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 78 (.NET Framework 4.5, Windows 8, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 92 (.NET Framework 4, Windows 8, Windows Phone 8.1)
Profile 102 (.NET Framework 4.0.3, Windows 8, Windows Phone 8.1)
Profile 111 (.NET Framework 4.5, Windows 8, Windows Phone 8.1) (netstandard 1.1)
Profile 136 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 147 (.NET Framework 4.0.3, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 158 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone Silverlight 8)
Profile 225 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1)
Profile 255 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone 8.1)
Profile 259 (.NET Framework 4.5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
Profile 328 (.NET Framework 4, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8) (netstandard 1.0)
Profile 336 (.NET Framework 4.0.3, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
Profile 344 (.NET Framework 4.5, Silverlight 5, Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8)
</code></pre>
<h3>Now what profile should you choose?</h3>
<p>My advice:</p>
<ul>
<li>If you're starting a brand new cross platform mobile .NET app today and looking to use a PCL for common code in your app, you should probably use <strong>Profile 111</strong> as it offers access to a lot of APIs not available in the other profiles.</li>
<li>If you're creating a library for consumption by a broad range of existing cross platform mobile .NET applications, you should look at <strong>Profile 259</strong> as it has broad reach and access to .NET 4.5 functionality.</li>
</ul>
<h4>If you're looking for a complete list of all PCL profiles, take a look at <a href="http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY">this great reference</a> created by <a href="http://blog.stephencleary.com">Stephen Cleary</a>.</h4>
https://www.danrigby.com/2014/04/16/xamarin-pcl-profile-notes/Notes on Using Various PCL Profiles with Xamarin<p><strong>Updated: 2016/06/09</strong></p>
<p>Below are some notes that I took today while researching various PCL profiles and their compatibility for use with Xamarin in Visual Studio.
It's by no means complete, and the known <a href="http://docs.xamarin.com/guides/android/advanced_topics/limitations/">limitations for Xamarin.Android</a> and <a href="http://docs.xamarin.com/guides/ios/advanced_topics/limitations/">Xamarin.iOS</a> apply in addition to what I noted below.</p>
<h3>Profile 44 (.NET 4.5.1, Windows 8.1) (netstandard 1.2)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 4.1+</a></li>
<li>
Similar to Profile 151, but includes access to data annotations and a subset of WCF APIs:
<ul>
<li>System.ComponentModel.Annotations</li>
<li>System.ComponentModel.DataAnnotations</li>
<li>System.ServiceModel</li>
<li>System.ServiceModel.Duplex</li>
<li>System.ServiceModel.Http</li>
<li>System.ServiceModel.NetTcp</li>
<li>System.ServiceModel.Primitives</li>
<li>System.ServiceModel.Security</li>
</ul>
</li>
<li>Most current and forward looking profile (at the expense of backward compatibility)</li>
</ul>
<h3>Profile 151 (.NET 4.5.1, Windows 8.1, Windows Phone 8.1) (netstandard 1.2)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 4.1+</a></li>
<li>
This is a slightly updated version of Profile 111
<ul>
<li>
Several assemblies updated to newer versions
<ul>
<li>System.Diagnostics.Tracing</li>
<li>System.Runtime</li>
<li>System.Runtime.InteropServices</li>
</ul>
</li>
<li>Access to System.Threading.Timer which isn’t available in Profile 111</li>
</ul>
</li>
</ul>
<h3>Profile 111 (.NET 4.5, Windows 8.0, Windows Phone 8.1) (netstandard 1.1)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>No WCF (Due to WP8.1 support)</li>
<li>
Access to (but not available in profiles 259, 344, 78, or 158):
<ul>
<li>Parallel Tasks</li>
<li>Parallel LINQ</li>
<li>Concurrent Collections</li>
<li>System.Net.Http</li>
<li>System.Numerics</li>
<li>System.IO.Compression</li>
</ul>
</li>
</ul>
<h3>Profile 259 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Windows Phone 8.1) (netstandard 1.0)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>Basically replaces Profile 78</li>
<li>No WCF (Due to WP8.1 support)</li>
<li>Very broad reach</li>
<li>This is probably the most common profile used by .NET PCL libraries right now</li>
</ul>
<h3>Profile 344 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Silverlight 5, Windows Phone 8.1)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>Basically replaces profile 158</li>
<li>Broadest Reach (most platforms) of the .NET 4.5+ Profiles at the expense of one of the most narrow API surfaces</li>
<li>No WCF (Due to WP8.1 support)</li>
<li>Async/Await requires use of a <a href="http://www.nuget.org/packages/Microsoft.Bcl.Async/">NuGet package</a> (Due to SL5 support)</li>
<li>Consider using Profile 259 unless Silverlight 5 support is required</li>
</ul>
<h3>Profile 78 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0) (netstandard 1.0)</h3>
<ul>
<li>Broad reach</li>
<li>Consider using Profile 259 unless WCF support is required</li>
</ul>
<h3>Profile 158 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Silverlight 5)</h3>
<ul>
<li>Broad reach</li>
<li>Async/Await requires use of a <a href="http://www.nuget.org/packages/Microsoft.Bcl.Async/">NuGet package</a> (Due to SL5 support)</li>
<li>Consider using Profile 259 unless Silverlight 5 or WCF support is required</li>
</ul>
2014-04-16T04:00:00Z2014-04-16T04:00:00ZDan Rigby<p><strong>Updated: 2016/06/09</strong></p>
<p>Below are some notes that I took today while researching various PCL profiles and their compatibility for use with Xamarin in Visual Studio.
It's by no means complete, and the known <a href="http://docs.xamarin.com/guides/android/advanced_topics/limitations/">limitations for Xamarin.Android</a> and <a href="http://docs.xamarin.com/guides/ios/advanced_topics/limitations/">Xamarin.iOS</a> apply in addition to what I noted below.</p>
<h3>Profile 44 (.NET 4.5.1, Windows 8.1) (netstandard 1.2)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 4.1+</a></li>
<li>
Similar to Profile 151, but includes access to data annotations and a subset of WCF APIs:
<ul>
<li>System.ComponentModel.Annotations</li>
<li>System.ComponentModel.DataAnnotations</li>
<li>System.ServiceModel</li>
<li>System.ServiceModel.Duplex</li>
<li>System.ServiceModel.Http</li>
<li>System.ServiceModel.NetTcp</li>
<li>System.ServiceModel.Primitives</li>
<li>System.ServiceModel.Security</li>
</ul>
</li>
<li>Most current and forward looking profile (at the expense of backward compatibility)</li>
</ul>
<h3>Profile 151 (.NET 4.5.1, Windows 8.1, Windows Phone 8.1) (netstandard 1.2)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 4.1+</a></li>
<li>
This is a slightly updated version of Profile 111
<ul>
<li>
Several assemblies updated to newer versions
<ul>
<li>System.Diagnostics.Tracing</li>
<li>System.Runtime</li>
<li>System.Runtime.InteropServices</li>
</ul>
</li>
<li>Access to System.Threading.Timer which isn’t available in Profile 111</li>
</ul>
</li>
</ul>
<h3>Profile 111 (.NET 4.5, Windows 8.0, Windows Phone 8.1) (netstandard 1.1)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>No WCF (Due to WP8.1 support)</li>
<li>
Access to (but not available in profiles 259, 344, 78, or 158):
<ul>
<li>Parallel Tasks</li>
<li>Parallel LINQ</li>
<li>Concurrent Collections</li>
<li>System.Net.Http</li>
<li>System.Numerics</li>
<li>System.IO.Compression</li>
</ul>
</li>
</ul>
<h3>Profile 259 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Windows Phone 8.1) (netstandard 1.0)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>Basically replaces Profile 78</li>
<li>No WCF (Due to WP8.1 support)</li>
<li>Very broad reach</li>
<li>This is probably the most common profile used by .NET PCL libraries right now</li>
</ul>
<h3>Profile 344 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Silverlight 5, Windows Phone 8.1)</h3>
<ul>
<li><a href="https://www.danrigby.com/2014/05/14/supported-pcl-profiles-xamarin-for-visual-studio-2/">Supported in Xamarin for Visual Studio 2.0+</a></li>
<li>Basically replaces profile 158</li>
<li>Broadest Reach (most platforms) of the .NET 4.5+ Profiles at the expense of one of the most narrow API surfaces</li>
<li>No WCF (Due to WP8.1 support)</li>
<li>Async/Await requires use of a <a href="http://www.nuget.org/packages/Microsoft.Bcl.Async/">NuGet package</a> (Due to SL5 support)</li>
<li>Consider using Profile 259 unless Silverlight 5 support is required</li>
</ul>
<h3>Profile 78 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0) (netstandard 1.0)</h3>
<ul>
<li>Broad reach</li>
<li>Consider using Profile 259 unless WCF support is required</li>
</ul>
<h3>Profile 158 (.NET 4.5, Windows 8.0, Windows Phone Silverlight 8.0, Silverlight 5)</h3>
<ul>
<li>Broad reach</li>
<li>Async/Await requires use of a <a href="http://www.nuget.org/packages/Microsoft.Bcl.Async/">NuGet package</a> (Due to SL5 support)</li>
<li>Consider using Profile 259 unless Silverlight 5 or WCF support is required</li>
</ul>
https://www.danrigby.com/2014/04/10/windowsphone81-pcl-xamarin-fix/Fix for Creating PCLs in Visual Studio That Target Windows Phone 8.1 and Xamarin<h3>Trouble in Paradise</h3>
<p>With <a href="http://www.buildwindows.com/">BUILD</a> over and the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=42307">Visual Studio Update 2 RC</a> released, many of us are playing with the new Windows Phone 8.1 bits.</p>
<p>However, if you're using Xamarin in Visual Studio and you've tried to create a new (or update an existing) Portable Class Library that targets both the new Windows Phone 8.1 application type and Xamarin iOS/Android, you may have encountered a problem:</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-error.png" alt="Visual Studio PCL Error" /></p>
<p>At this moment, Xamarin is aware of the issue and a fix will be coming in an updated release of the Xamarin tools for Visual Studio, but if you're impatient like me and want/need to use the bits <em>RIGHT NOW</em>, there is in fact a workaround...</p>
<h3>A New Hope</h3>
<p>So what do we need to do? Turns out the workaround is pretty straight forward.</p>
<p>Open up the <code>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\SupportedFrameworks</code> folder (changing the drive letter accordingly) and select <code>Xamarin.Android.xml</code> and <code>Xamarin.iOS.xml</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-frameworksfolder1.png" alt="Supported Framework Files Source" /></p>
<p>If you only have Xamarin for iOS or Xamarin for Android installed, you may only see one of these 2 files and that's perfectly fine.</p>
<p>Now we're going to copy the file(s) to <code>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks</code>. You may be prompted for administrator rights to do this, just click ok.</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-frameworksfolder2.png" alt="Supported Framework Files Source" /></p>
<p>So, why did we choose Profile 259 anyway? </p>
<p>Well, prior to Visual Studio 2013 Update 2, Xamarin's best supported (and <a href="https://twitter.com/HassanFad/status/451867086545887232/photo/1/large">favorite</a>) profile was PCL profile 78. </p>
<p>PCL Profile 259 is Profile 78 + Windows Phone 8.1 (and the <a href="https://twitter.com/dsplaisted/status/451487953483620352">"new profile 78"</a>) which should give us the highest amount of compatibility.</p>
<p>At this point close Visual Studio (if it was still open) and then launch it again.</p>
<p>Now if we select .NET Framework 4.5, Windows 8, Windows Phone Silverlight 8, Windows Phone 8.1, Xamarin.Android, and/or Xamarin.iOS everything should work...</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-noerror1.png" alt="Supported Framework Files Source" /></p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-noerror2.png" alt="Supported Framework Files Source" /></p>
<h3>Epilogue</h3>
<p>If you can't use Profile 259 because you need to support different platform targets, this fix works for <a href="http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY/preview">other profile numbers</a> as well, though Xamarin compatibility may be dimished as the PCL Profile may support some functionality that one or more of the Xamarin platforms can't (ex. dynamic).</p>
<p>A good example would be if you also needed to target Silverlight 5. You would copy the two xml files into the <code>.NETPortable\v4.0\Profile\Profile344</code> folder (This is also a very good profile for Xamarin development).</p>
<h3>Credits</h3>
<p>This fix comes courtesy of <a href="https://twitter.com/onovotny">Oren Novotny</a>, so if it helps you, be sure to thank (and follow) him!</p>
2014-04-10T04:00:00Z2014-04-10T04:00:00ZDan Rigby<h3>Trouble in Paradise</h3>
<p>With <a href="http://www.buildwindows.com/">BUILD</a> over and the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=42307">Visual Studio Update 2 RC</a> released, many of us are playing with the new Windows Phone 8.1 bits.</p>
<p>However, if you're using Xamarin in Visual Studio and you've tried to create a new (or update an existing) Portable Class Library that targets both the new Windows Phone 8.1 application type and Xamarin iOS/Android, you may have encountered a problem:</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-error.png" alt="Visual Studio PCL Error" /></p>
<p>At this moment, Xamarin is aware of the issue and a fix will be coming in an updated release of the Xamarin tools for Visual Studio, but if you're impatient like me and want/need to use the bits <em>RIGHT NOW</em>, there is in fact a workaround...</p>
<h3>A New Hope</h3>
<p>So what do we need to do? Turns out the workaround is pretty straight forward.</p>
<p>Open up the <code>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\SupportedFrameworks</code> folder (changing the drive letter accordingly) and select <code>Xamarin.Android.xml</code> and <code>Xamarin.iOS.xml</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-frameworksfolder1.png" alt="Supported Framework Files Source" /></p>
<p>If you only have Xamarin for iOS or Xamarin for Android installed, you may only see one of these 2 files and that's perfectly fine.</p>
<p>Now we're going to copy the file(s) to <code>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks</code>. You may be prompted for administrator rights to do this, just click ok.</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-frameworksfolder2.png" alt="Supported Framework Files Source" /></p>
<p>So, why did we choose Profile 259 anyway? </p>
<p>Well, prior to Visual Studio 2013 Update 2, Xamarin's best supported (and <a href="https://twitter.com/HassanFad/status/451867086545887232/photo/1/large">favorite</a>) profile was PCL profile 78. </p>
<p>PCL Profile 259 is Profile 78 + Windows Phone 8.1 (and the <a href="https://twitter.com/dsplaisted/status/451487953483620352">"new profile 78"</a>) which should give us the highest amount of compatibility.</p>
<p>At this point close Visual Studio (if it was still open) and then launch it again.</p>
<p>Now if we select .NET Framework 4.5, Windows 8, Windows Phone Silverlight 8, Windows Phone 8.1, Xamarin.Android, and/or Xamarin.iOS everything should work...</p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-noerror1.png" alt="Supported Framework Files Source" /></p>
<p><img src="https://www.danrigby.com/images/xamarin-vs2013-winphone81-pcl-noerror2.png" alt="Supported Framework Files Source" /></p>
<h3>Epilogue</h3>
<p>If you can't use Profile 259 because you need to support different platform targets, this fix works for <a href="http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY/preview">other profile numbers</a> as well, though Xamarin compatibility may be dimished as the PCL Profile may support some functionality that one or more of the Xamarin platforms can't (ex. dynamic).</p>
<p>A good example would be if you also needed to target Silverlight 5. You would copy the two xml files into the <code>.NETPortable\v4.0\Profile\Profile344</code> folder (This is also a very good profile for Xamarin development).</p>
<h3>Credits</h3>
<p>This fix comes courtesy of <a href="https://twitter.com/onovotny">Oren Novotny</a>, so if it helps you, be sure to thank (and follow) him!</p>
https://www.danrigby.com/2014/02/28/annoucing-xamarinappdev/Announcing AllAboutXamarin.com and @AllAboutXamarin<p>Some of you may have noticed that I silently launched a new link blog and Twitter account on Monday. Today I'm formally announcing both: Say hello to <a href="http://allaboutxamarin.com">http://AllAboutXamarin.com</a> and <a href="http://twitter.com/AllAboutXamarin">@AllAboutXamarin</a>!</p>
<p><a href="http://twitter.com/AllAboutXamarin"><img class="aligncenter" title="AllAboutXamarin on Twitter" src="https://www.danrigby.com/images/allaboutxamarin-twitter.png" alt="AllAboutXamarin on Twitter" /></a></p>
<p>I've been working on a very large native cross platform application for a client that runs on iOS, Android, Windows Phone, and Windows Store, leveraging the <a href="http://xamarin.com">Xamarin</a> tools. A natural extension of that process has been searching for news and content about what is going on in the Xamarin developer community.</p>
<p>So following in the footsteps of <a href="http://windowsappdev.com">http://WindowsAppDev.com</a> and <a href="http://twitter.com/WindowsAppDev">@WindowsAppDev</a>, my hope is that the new site and and Twitter feed will be a valuable resource for the Xamarin community.</p>
<p>And fear not, I won't be neglecting my Windows developer readership. My family, <em>maybe</em>, but not you dear mobile app developer community. (:</p>
2014-02-28T05:00:00Z2014-02-28T05:00:00ZDan Rigby<p>Some of you may have noticed that I silently launched a new link blog and Twitter account on Monday. Today I'm formally announcing both: Say hello to <a href="http://allaboutxamarin.com">http://AllAboutXamarin.com</a> and <a href="http://twitter.com/AllAboutXamarin">@AllAboutXamarin</a>!</p>
<p><a href="http://twitter.com/AllAboutXamarin"><img class="aligncenter" title="AllAboutXamarin on Twitter" src="https://www.danrigby.com/images/allaboutxamarin-twitter.png" alt="AllAboutXamarin on Twitter" /></a></p>
<p>I've been working on a very large native cross platform application for a client that runs on iOS, Android, Windows Phone, and Windows Store, leveraging the <a href="http://xamarin.com">Xamarin</a> tools. A natural extension of that process has been searching for news and content about what is going on in the Xamarin developer community.</p>
<p>So following in the footsteps of <a href="http://windowsappdev.com">http://WindowsAppDev.com</a> and <a href="http://twitter.com/WindowsAppDev">@WindowsAppDev</a>, my hope is that the new site and and Twitter feed will be a valuable resource for the Xamarin community.</p>
<p>And fear not, I won't be neglecting my Windows developer readership. My family, <em>maybe</em>, but not you dear mobile app developer community. (:</p>
https://www.danrigby.com/2014/02/27/enabling-nuget-in-xamarin-studio/Enabling NuGet Support in Xamarin Studio<p>Previously we looked how to configure Xamarin Studio to <a href="https://www.danrigby.com/2014/02/26/xamarin-studio-settings-for-visual-studio-developers/">feel a bit more familiar</a> to those of us coming from Visual Studio. Now we're going to take a look at how to install the NuGet package manager Add-in for Xamarin Studio.</p>
<h3>NuGet</h3>
<p>Adding the NuGet Add-in isn't difficult, but there are a number of steps involved.</p>
<p>Open the <code>Tools</code> menu, then click on <code>Add-in Manager</code>. On OSX you can find this option under the <code>Xamarin Studio</code> menu.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-1.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Select the <code>Gallery</code> tab, open the Repository drop down menu, sand and select <code>Manage Repositories...</code></p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-2.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Click on the <code>Add</code> button in the <code>Add-in Repository Management</code> window.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-3.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>On the <code>Add New Repository</code> window, select <code>Register an on-line repository</code>, enter <code>http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep</code> for the url, and click <code>OK</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-4.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Back on the <code>Add-in Repository Management</code> window, we're going to open the <code>IDE extensions</code> node in the left panel, select <code>NuGet Package Management</code>, and click on the <code>Install</code> buttton located at the bottom of the right panel.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-5.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>This is going to open a prompt asking us the confirm the installation of the Add-in. Click on <code>Install</code> in the dialog, then go ahead and click on the <code>Close</code> button on the <code>Add-in Repository Management</code> window.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-6.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Bask in our freshly installed NuGet-y goodness. You'll find two new menu options when you right click on a Solution, Project, or Project References node in the Solution Pad (the different tool windows in Xamarin Studio are called <em>Pads</em>): <code>Manage NuGet Packages...</code> and <code>Restore NuGet Packages</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-7.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>A big thanks to <a href="http://community.sharpdevelop.net/blogs/mattward/">Matt Ward</a> for creating the MonoDevelop/Xamarin Studio NuGet Add-in. Head over to the <a href="https://github.com/mrward/monodevelop-nuget-addin">MonoDevelop NuGet Add-in project site on GitHub</a> to learn even more about using the Add-in.</p>
2014-02-27T05:00:00Z2014-02-27T05:00:00ZDan Rigby<p>Previously we looked how to configure Xamarin Studio to <a href="https://www.danrigby.com/2014/02/26/xamarin-studio-settings-for-visual-studio-developers/">feel a bit more familiar</a> to those of us coming from Visual Studio. Now we're going to take a look at how to install the NuGet package manager Add-in for Xamarin Studio.</p>
<h3>NuGet</h3>
<p>Adding the NuGet Add-in isn't difficult, but there are a number of steps involved.</p>
<p>Open the <code>Tools</code> menu, then click on <code>Add-in Manager</code>. On OSX you can find this option under the <code>Xamarin Studio</code> menu.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-1.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Select the <code>Gallery</code> tab, open the Repository drop down menu, sand and select <code>Manage Repositories...</code></p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-2.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Click on the <code>Add</code> button in the <code>Add-in Repository Management</code> window.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-3.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>On the <code>Add New Repository</code> window, select <code>Register an on-line repository</code>, enter <code>http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep</code> for the url, and click <code>OK</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-4.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Back on the <code>Add-in Repository Management</code> window, we're going to open the <code>IDE extensions</code> node in the left panel, select <code>NuGet Package Management</code>, and click on the <code>Install</code> buttton located at the bottom of the right panel.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-5.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>This is going to open a prompt asking us the confirm the installation of the Add-in. Click on <code>Install</code> in the dialog, then go ahead and click on the <code>Close</code> button on the <code>Add-in Repository Management</code> window.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-6.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>Bask in our freshly installed NuGet-y goodness. You'll find two new menu options when you right click on a Solution, Project, or Project References node in the Solution Pad (the different tool windows in Xamarin Studio are called <em>Pads</em>): <code>Manage NuGet Packages...</code> and <code>Restore NuGet Packages</code>.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-nuget-step-7.png" alt="NuGet for Xamarin Studio Step 1" /></p>
<p>A big thanks to <a href="http://community.sharpdevelop.net/blogs/mattward/">Matt Ward</a> for creating the MonoDevelop/Xamarin Studio NuGet Add-in. Head over to the <a href="https://github.com/mrward/monodevelop-nuget-addin">MonoDevelop NuGet Add-in project site on GitHub</a> to learn even more about using the Add-in.</p>
https://www.danrigby.com/2014/02/26/xamarin-studio-settings-for-visual-studio-developers/Xamarin Studio Settings for Visual Studio Developers<p>If you are like me, a Visual Studio developer just getting started with Xamarin Studio, this new environment can seem a bit alien. Here's a couple of quick settings you can change to make yourself feel much more at home in the Xamarin IDE.</p>
<p>The instructions below are for Xamarin Studio running on Windows, but if you are using Xamarin Studio on OSX, just open <code>Xamarin Studio</code>, <code>Preferences</code> whenever you see <code>Tools</code>, <code>Options</code> in the steps.</p>
<h3>Code Folding</h3>
<p>Under <code>Tools</code>, <code>Options</code>, then <code>Text Editor</code>, select <code>General</code>. On this screen, you can just tick the box for <code>Enable code folding</code>, and you're all set. </p>
<p>Optionally, you can also tell Xamarin Studio whether it should collapse by default code #regions and code comments in the editor.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-codefolding-setting.png" alt="Code Folding Options in Xamarin Studio" /></p>
<h3>Syntax Highlighting</h3>
<p>Also under <code>Tools</code>, <code>Options</code>, and <code>Text Editor</code>, you'll find the <code>Syntax Highlighting</code> settings. Here you can tell Xamarin Studio to use a syntax highlighting theme that closely resembles the one used by Visual Studio.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-syntaxhighlighting-visualstudio-setting.png" alt="Visual Studio Colored Syntax Highlighting in Xamarin Studio" /></p>
<h3>Key Bindings</h3>
<p>Under <code>Tools</code>, <code>Options</code>, then <code>Environment</code>, you'll find the <code>Key Bindings</code> settings. Here you can change the key binding scheme to match Visual Studio. This scheme appears to only be available in the Windows version of Xamarin Studio.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-visualstudio-keybindings-setting.png" alt="Visual Studio Key Bindings in Xamarin Studio" /></p>
<p>In my copy of Xamarin Studio (I'm using the Alpha channel), this key binding scheme has a conflict with <code>Control + .</code> being bound to two different commands. I resolved this by changing the quick fix command to use <code>Alt + Enter</code> which should be familiar to ReSharper users.</p>
<h3>Source Analysis</h3>
<p>This last one is less of a Visual Studio familiarity issue <em>per se</em>, but rather for those of us who might be missing ReSharper in this new IDE. Under <code>Tools</code>, <code>Options</code>, then <code>Text Editor</code>, you'll find the <code>Source Analysis</code> settings. Turn this on to get real-time feedback in the code editor about the your code, similar to RS.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-sourceanalysis-setting.png" alt="Xamarin Studio Source Analysis" /></p>
<p>These settings go a long way toward mitigating the friction of moving between Visual Studio and Xamarin Studio. </p>
<p>Maybe once I'm more familiar moving around inside Xamarin's IDE, I will consider changing the key bindings and syntax highlighting back to their defaults. Or not... (:</p>
2014-02-26T05:00:00Z2014-02-26T05:00:00ZDan Rigby<p>If you are like me, a Visual Studio developer just getting started with Xamarin Studio, this new environment can seem a bit alien. Here's a couple of quick settings you can change to make yourself feel much more at home in the Xamarin IDE.</p>
<p>The instructions below are for Xamarin Studio running on Windows, but if you are using Xamarin Studio on OSX, just open <code>Xamarin Studio</code>, <code>Preferences</code> whenever you see <code>Tools</code>, <code>Options</code> in the steps.</p>
<h3>Code Folding</h3>
<p>Under <code>Tools</code>, <code>Options</code>, then <code>Text Editor</code>, select <code>General</code>. On this screen, you can just tick the box for <code>Enable code folding</code>, and you're all set. </p>
<p>Optionally, you can also tell Xamarin Studio whether it should collapse by default code #regions and code comments in the editor.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-codefolding-setting.png" alt="Code Folding Options in Xamarin Studio" /></p>
<h3>Syntax Highlighting</h3>
<p>Also under <code>Tools</code>, <code>Options</code>, and <code>Text Editor</code>, you'll find the <code>Syntax Highlighting</code> settings. Here you can tell Xamarin Studio to use a syntax highlighting theme that closely resembles the one used by Visual Studio.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-syntaxhighlighting-visualstudio-setting.png" alt="Visual Studio Colored Syntax Highlighting in Xamarin Studio" /></p>
<h3>Key Bindings</h3>
<p>Under <code>Tools</code>, <code>Options</code>, then <code>Environment</code>, you'll find the <code>Key Bindings</code> settings. Here you can change the key binding scheme to match Visual Studio. This scheme appears to only be available in the Windows version of Xamarin Studio.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-visualstudio-keybindings-setting.png" alt="Visual Studio Key Bindings in Xamarin Studio" /></p>
<p>In my copy of Xamarin Studio (I'm using the Alpha channel), this key binding scheme has a conflict with <code>Control + .</code> being bound to two different commands. I resolved this by changing the quick fix command to use <code>Alt + Enter</code> which should be familiar to ReSharper users.</p>
<h3>Source Analysis</h3>
<p>This last one is less of a Visual Studio familiarity issue <em>per se</em>, but rather for those of us who might be missing ReSharper in this new IDE. Under <code>Tools</code>, <code>Options</code>, then <code>Text Editor</code>, you'll find the <code>Source Analysis</code> settings. Turn this on to get real-time feedback in the code editor about the your code, similar to RS.</p>
<p><img src="https://www.danrigby.com/images/xamarinstudio-sourceanalysis-setting.png" alt="Xamarin Studio Source Analysis" /></p>
<p>These settings go a long way toward mitigating the friction of moving between Visual Studio and Xamarin Studio. </p>
<p>Maybe once I'm more familiar moving around inside Xamarin's IDE, I will consider changing the key bindings and syntax highlighting back to their defaults. Or not... (:</p>
https://www.danrigby.com/2014/02/17/blog-and-site-updates/Announcing WindowsAppDev.com (and other site updates)<h3>Site Changes</h3>
<p>If you're visiting my site right now you may have noticed a new theme and a snappier response time.</p>
<p>Also, you may have noticed that the Windows App Developer Links posts are not immediately visible. Fear not, for they have finally been given the respect they truly deserve and now have their very own site at <a href="http://WindowsAppDev.com">WindowsAppDev.com</a>!</p>
<p>What this does mean though, is if you are subscribed to my blog feed (and you are subscribed, <em>right</em>?), if you want to continue to receive my (almost) daily Windows App Developer Links, you'll need to subscribe to the <a href="http://feeds.feedburner.com/WindowsAppDev">new feed</a>.</p>
<h3>Technical Details</h3>
<p>This new blog is created using <a href="http://blog.jonathanchannon.com/2013/10/01/blogging-with-markdown-and-git/">Sandra.Snow</a> and the <a href="https://github.com/Sandra/Sandra.Snow.SnowTemplate">Sandra.Snow.Template</a>. I was previously using WordPress and while it made life simple, I'm not a PHP guy and making tweaks to the site was a bit painful.</p>
<p>This blog (and WindowsAppDev.com) are now running on a new VPS in Los Angeles. While I love my old host, the performance of running WordPress in a shared hosting environment wasn't great and wasn't getting better over time.</p>
<p>Both sites are setup to use a git repository that I push to the VPS over ssh and then a post receive hook on the server uses rsync to copy the changed files to the their respective webserver folder and fixes their file permissions.</p>
<p>So what this should mean <strong><em>for me</em></strong> is my site is much more portable (I can literally just copy a bunch of files to a new web server), more fault tolerant (I have multiple copies of the website source), and more secure (there's no CMS to break into, it's just static files).</p>
<p>What this should mean <strong><em>for you</em></strong>, is the site is much faster, a bit more mobile friendly, and you can choose what you want to see in terms of my content posts and my Windows App Developer Links posts. Choice is a good thing. ☺</p>
2014-02-17T05:00:00Z2014-02-17T05:00:00ZDan Rigby<h3>Site Changes</h3>
<p>If you're visiting my site right now you may have noticed a new theme and a snappier response time.</p>
<p>Also, you may have noticed that the Windows App Developer Links posts are not immediately visible. Fear not, for they have finally been given the respect they truly deserve and now have their very own site at <a href="http://WindowsAppDev.com">WindowsAppDev.com</a>!</p>
<p>What this does mean though, is if you are subscribed to my blog feed (and you are subscribed, <em>right</em>?), if you want to continue to receive my (almost) daily Windows App Developer Links, you'll need to subscribe to the <a href="http://feeds.feedburner.com/WindowsAppDev">new feed</a>.</p>
<h3>Technical Details</h3>
<p>This new blog is created using <a href="http://blog.jonathanchannon.com/2013/10/01/blogging-with-markdown-and-git/">Sandra.Snow</a> and the <a href="https://github.com/Sandra/Sandra.Snow.SnowTemplate">Sandra.Snow.Template</a>. I was previously using WordPress and while it made life simple, I'm not a PHP guy and making tweaks to the site was a bit painful.</p>
<p>This blog (and WindowsAppDev.com) are now running on a new VPS in Los Angeles. While I love my old host, the performance of running WordPress in a shared hosting environment wasn't great and wasn't getting better over time.</p>
<p>Both sites are setup to use a git repository that I push to the VPS over ssh and then a post receive hook on the server uses rsync to copy the changed files to the their respective webserver folder and fixes their file permissions.</p>
<p>So what this should mean <strong><em>for me</em></strong> is my site is much more portable (I can literally just copy a bunch of files to a new web server), more fault tolerant (I have multiple copies of the website source), and more secure (there's no CMS to break into, it's just static files).</p>
<p>What this should mean <strong><em>for you</em></strong>, is the site is much faster, a bit more mobile friendly, and you can choose what you want to see in terms of my content posts and my Windows App Developer Links posts. Choice is a good thing. ☺</p>
https://www.danrigby.com/2012/09/24/announcing-the-win8devnews-twitter-account/Announcing the @Win8DevNews Twitter Account<img class="alignleft" title="Twitter Logo" src="https://www.danrigby.com/images/twitter-bird-light-bgs.png" alt="Twitter Logo" width="150" height="150" />
<p>If you've been following me on Twitter recently, you may have noticed me mention the <a href="http://twitter.com/WindowsAppDev">@Win8DevNews</a> Twitter account.</p>
<p>Today I'd like to take the opportunity to formally announce that I've teamed up with <a href="http://michaelcrump.net/">Michael Crump</a> (of <a href="http://www.telerik.com/community/evangelists/michael-crump.aspx">Telerik fame</a>) to provide a Twitter feed of all the latest news and links relevant to Windows 8 app developers.</p>
<p>If you're a current RSS subscriber or daily visitor to my Windows 8 Developer links blog, then this Twitter account will provide a new way of getting the same great curated Windows 8 Developer links.</p>
<p>Head on over to Twitter and follow Win8DevNews (<a href="http://twitter.com/WindowsAppDev">@Win8DevNews</a>) to join in.</p>
<p>Be sure to follow me (<a href="http://twitter.com/danrigby">@DanRigby</a>) and Michael (<a href="http://twitter.com/mbcrump">@MbCrump</a>) while you're there.</p>
<p>A great many thanks goes out to Michael who registered the Win8DevNews Twitter handle and the <a href="http://windowsappdev.com">Win8DevNews.com</a> domain a while back and decided to reach out to me about putting them to good use for the Windows 8 Developer community.</p>
<p>Michael has also <a href="http://michaelcrump.net/announcing-win8devnews-windows-8-developer-news">posted a great write-up</a> on his blog about Win8DevNews, so be sure to check it out!</p>
2012-09-24T04:00:00Z2012-09-24T04:00:00ZDan Rigby<img class="alignleft" title="Twitter Logo" src="https://www.danrigby.com/images/twitter-bird-light-bgs.png" alt="Twitter Logo" width="150" height="150" />
<p>If you've been following me on Twitter recently, you may have noticed me mention the <a href="http://twitter.com/WindowsAppDev">@Win8DevNews</a> Twitter account.</p>
<p>Today I'd like to take the opportunity to formally announce that I've teamed up with <a href="http://michaelcrump.net/">Michael Crump</a> (of <a href="http://www.telerik.com/community/evangelists/michael-crump.aspx">Telerik fame</a>) to provide a Twitter feed of all the latest news and links relevant to Windows 8 app developers.</p>
<p>If you're a current RSS subscriber or daily visitor to my Windows 8 Developer links blog, then this Twitter account will provide a new way of getting the same great curated Windows 8 Developer links.</p>
<p>Head on over to Twitter and follow Win8DevNews (<a href="http://twitter.com/WindowsAppDev">@Win8DevNews</a>) to join in.</p>
<p>Be sure to follow me (<a href="http://twitter.com/danrigby">@DanRigby</a>) and Michael (<a href="http://twitter.com/mbcrump">@MbCrump</a>) while you're there.</p>
<p>A great many thanks goes out to Michael who registered the Win8DevNews Twitter handle and the <a href="http://windowsappdev.com">Win8DevNews.com</a> domain a while back and decided to reach out to me about putting them to good use for the Windows 8 Developer community.</p>
<p>Michael has also <a href="http://michaelcrump.net/announcing-win8devnews-windows-8-developer-news">posted a great write-up</a> on his blog about Win8DevNews, so be sure to check it out!</p>
https://www.danrigby.com/2012/07/24/windows-8-dev-tip-nullable-dependency-properties-and-binding/Windows 8 Dev Tip: Nullable<T> Dependency Properties and Binding<p><em>Author's Note: If you're here just for a solution and are not interested in the extraneous bits, feel free to <a href="https://www.danrigby.com/#workaround">jump to the workaround details</a>.</em></p>
<h2>First, some background...</h2>
<p>Let's say you're building a user control and one of your control's properties needs to be a three state boolean (true, false, null).</p>
<p>No sweat, we'll just create a nullable boolean (bool?) <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh700353.aspx">dependency property</a>:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null));
</code></pre>
<p>Ok, now that we have that taken care of, we want the user control to display different colors based on the value of the Value property.</p>
<p>So let's add logic to handle the onchange callback of the dependency property:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
private static void ValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) {
((TestControl)sender).ValueChanged();
}
private void ValueChanged() {
bool? value = this.Value;
if (!value.HasValue) {
this.grid.Background = new SolidColorBrush(Colors.Blue);
}
else if (value.Value) {
this.grid.Background = new SolidColorBrush(Colors.Green);
}
else {
this.grid.Background = new SolidColorBrush(Colors.Red);
}
}
</code></pre>
<p>Doing good, now lets piece it all together by adding a main page, binding our new user control to the page's datacontext, and creating a few radio buttons to change the value of the datacontext:</p>
<h5>TestControl.xaml:</h5>
<pre><code><UserControl x:Class="NullableBoolBinding.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Name="grid" Background="Blue"/>
</UserControl>
</code></pre>
<h5>TestControl.xaml.cs:</h5>
<pre><code>using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace NullableBoolBinding
{
public sealed partial class TestControl : UserControl
{
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
public bool? Value {
get { return (bool?)this.GetValue(ValueProperty); }
set { this.SetValue(ValueProperty, value); }
}
public TestControl() {
this.InitializeComponent();
}
private static void ValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) {
((TestControl)sender).ValueChanged();
}
private void ValueChanged() {
bool? value = this.Value;
if (!value.HasValue) {
this.grid.Background = new SolidColorBrush(Colors.Blue);
}
else if (value.Value) {
this.grid.Background = new SolidColorBrush(Colors.Green);
}
else {
this.grid.Background = new SolidColorBrush(Colors.Red);
}
}
}
}
</code></pre>
<h5>MainPage.xaml:</h5>
<pre><code><Page x:Class="NullableBoolBinding.MainPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NullableBoolBinding">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<local:TestControl Value="{Binding}"/>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
Grid.Row="1">
<RadioButton Content="True"
Checked="TrueRadioButtonChecked"
Margin="10"/>
<RadioButton Content="False"
Checked="FalseRadioButtonChecked"
Margin="10"/>
<RadioButton Content="Null"
Checked="NullRadioButtonChecked"
Margin="10"/>
</StackPanel>
</Grid>
</Page>
</code></pre>
<h5>MainPage.xaml.cs:</h5>
<pre><code>using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace NullableBoolBinding
{
public sealed partial class MainPage : Page
{
public MainPage() {
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e) {
this.DataContext = null;
}
private void TrueRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = true;
}
private void FalseRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = false;
}
private void NullRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = null;
}
}
}
</code></pre>
<p>Ok, we're done, so let's fire up our new app and test it out!</p>
<p><img src="https://www.danrigby.com/images/nullable-bool-binding-1.png" alt="Binding Failure" /></p>
<p>Wait a second... the null value works, but when you select true or false nothing changes. What gives?</p>
<p>Glancing at our output window while we have the debugger attached gives us this piece of information:</p>
<pre><code>Error: Converter failed to convert value of type 'Windows.Foundation.IReference`1<Boolean>' to type 'IReference`1<Boolean>'; BindingExpression: Path='' DataItem='Windows.Foundation.IReference`1<Boolean>'; target element is 'NullableBoolBinding.TestControl' (Name='null'); target property is 'Value' (type 'IReference`1<Boolean>').
</code></pre>
<p>Ok then, what the heck is a IReference`1<Boolean> and why are we trying to convert it?</p>
<p>Turns out that under the covers most of the .NET primitive types are converted to equivalent Windows Runtime types. <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br225864.aspx">IReference<T></a> happens to be the Windows Runtime equivalent of <a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx">Nullable<T></a> in .NET. In fact, Jeremy Likness has a <a href="http://csharperimage.jeremylikness.com/2012/03/net-and-metro-windows-runtime-and-clr.html">good blog post WinRT/.NET type conversion</a> that I'd recommend taking a look at.</p>
<p>So right about now you're thinking, "<em>Great, thanks for the technological archaeology lesson, but that doesn't explain why it's not working or what I need to do to fix it...</em>"</p>
<p>So, despite some considerable effort in researching the issue (and finding a <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/438ca2a5-e556-4361-8140-b106875b1ddc/">WinRT dev forum post saying that nullable dependency properties in custom user controls are not supported</a>), I couldn't find any explanation as to <em>why</em> this fails, but it turns out there is a workaround...</p>
<p><a name="answer"></a></p>
<h2 id="workaround">And the answer is...</h2>
<p>Change the dependency property type to object. So, in our example, we change:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
</code></pre>
<p>to:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(object),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
</code></pre>
<p>That's it. At this point everything just starts working as expected. You don't even have to change your instance property type.</p>
<p><img src="https://www.danrigby.com/images/nullable-bool-binding-2.png" alt="Binding Success" /></p>
<p>It's a shame reflection doesn't work on the WinRT XAML controls since they're written in native code, because I'd love to see how the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.primitives.togglebutton.ischecked.aspx">ToggleButton.IsChecked</a> property is implemented...</p>
2012-07-24T04:00:00Z2012-07-24T04:00:00ZDan Rigby<p><em>Author's Note: If you're here just for a solution and are not interested in the extraneous bits, feel free to <a href="https://www.danrigby.com/#workaround">jump to the workaround details</a>.</em></p>
<h2>First, some background...</h2>
<p>Let's say you're building a user control and one of your control's properties needs to be a three state boolean (true, false, null).</p>
<p>No sweat, we'll just create a nullable boolean (bool?) <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh700353.aspx">dependency property</a>:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null));
</code></pre>
<p>Ok, now that we have that taken care of, we want the user control to display different colors based on the value of the Value property.</p>
<p>So let's add logic to handle the onchange callback of the dependency property:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
private static void ValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) {
((TestControl)sender).ValueChanged();
}
private void ValueChanged() {
bool? value = this.Value;
if (!value.HasValue) {
this.grid.Background = new SolidColorBrush(Colors.Blue);
}
else if (value.Value) {
this.grid.Background = new SolidColorBrush(Colors.Green);
}
else {
this.grid.Background = new SolidColorBrush(Colors.Red);
}
}
</code></pre>
<p>Doing good, now lets piece it all together by adding a main page, binding our new user control to the page's datacontext, and creating a few radio buttons to change the value of the datacontext:</p>
<h5>TestControl.xaml:</h5>
<pre><code><UserControl x:Class="NullableBoolBinding.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Name="grid" Background="Blue"/>
</UserControl>
</code></pre>
<h5>TestControl.xaml.cs:</h5>
<pre><code>using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace NullableBoolBinding
{
public sealed partial class TestControl : UserControl
{
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
public bool? Value {
get { return (bool?)this.GetValue(ValueProperty); }
set { this.SetValue(ValueProperty, value); }
}
public TestControl() {
this.InitializeComponent();
}
private static void ValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) {
((TestControl)sender).ValueChanged();
}
private void ValueChanged() {
bool? value = this.Value;
if (!value.HasValue) {
this.grid.Background = new SolidColorBrush(Colors.Blue);
}
else if (value.Value) {
this.grid.Background = new SolidColorBrush(Colors.Green);
}
else {
this.grid.Background = new SolidColorBrush(Colors.Red);
}
}
}
}
</code></pre>
<h5>MainPage.xaml:</h5>
<pre><code><Page x:Class="NullableBoolBinding.MainPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NullableBoolBinding">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<local:TestControl Value="{Binding}"/>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
Grid.Row="1">
<RadioButton Content="True"
Checked="TrueRadioButtonChecked"
Margin="10"/>
<RadioButton Content="False"
Checked="FalseRadioButtonChecked"
Margin="10"/>
<RadioButton Content="Null"
Checked="NullRadioButtonChecked"
Margin="10"/>
</StackPanel>
</Grid>
</Page>
</code></pre>
<h5>MainPage.xaml.cs:</h5>
<pre><code>using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace NullableBoolBinding
{
public sealed partial class MainPage : Page
{
public MainPage() {
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e) {
this.DataContext = null;
}
private void TrueRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = true;
}
private void FalseRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = false;
}
private void NullRadioButtonChecked(object sender, RoutedEventArgs e) {
this.DataContext = null;
}
}
}
</code></pre>
<p>Ok, we're done, so let's fire up our new app and test it out!</p>
<p><img src="https://www.danrigby.com/images/nullable-bool-binding-1.png" alt="Binding Failure" /></p>
<p>Wait a second... the null value works, but when you select true or false nothing changes. What gives?</p>
<p>Glancing at our output window while we have the debugger attached gives us this piece of information:</p>
<pre><code>Error: Converter failed to convert value of type 'Windows.Foundation.IReference`1<Boolean>' to type 'IReference`1<Boolean>'; BindingExpression: Path='' DataItem='Windows.Foundation.IReference`1<Boolean>'; target element is 'NullableBoolBinding.TestControl' (Name='null'); target property is 'Value' (type 'IReference`1<Boolean>').
</code></pre>
<p>Ok then, what the heck is a IReference`1<Boolean> and why are we trying to convert it?</p>
<p>Turns out that under the covers most of the .NET primitive types are converted to equivalent Windows Runtime types. <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br225864.aspx">IReference<T></a> happens to be the Windows Runtime equivalent of <a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx">Nullable<T></a> in .NET. In fact, Jeremy Likness has a <a href="http://csharperimage.jeremylikness.com/2012/03/net-and-metro-windows-runtime-and-clr.html">good blog post WinRT/.NET type conversion</a> that I'd recommend taking a look at.</p>
<p>So right about now you're thinking, "<em>Great, thanks for the technological archaeology lesson, but that doesn't explain why it's not working or what I need to do to fix it...</em>"</p>
<p>So, despite some considerable effort in researching the issue (and finding a <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/438ca2a5-e556-4361-8140-b106875b1ddc/">WinRT dev forum post saying that nullable dependency properties in custom user controls are not supported</a>), I couldn't find any explanation as to <em>why</em> this fails, but it turns out there is a workaround...</p>
<p><a name="answer"></a></p>
<h2 id="workaround">And the answer is...</h2>
<p>Change the dependency property type to object. So, in our example, we change:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(bool?),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
</code></pre>
<p>to:</p>
<pre><code>public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",
typeof(object),
typeof(TestControl),
new PropertyMetadata(null, ValueChanged));
</code></pre>
<p>That's it. At this point everything just starts working as expected. You don't even have to change your instance property type.</p>
<p><img src="https://www.danrigby.com/images/nullable-bool-binding-2.png" alt="Binding Success" /></p>
<p>It's a shame reflection doesn't work on the WinRT XAML controls since they're written in native code, because I'd love to see how the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.primitives.togglebutton.ischecked.aspx">ToggleButton.IsChecked</a> property is implemented...</p>
https://www.danrigby.com/2012/07/18/windows-8-dev-tip-animating-attached-properties/Windows 8 Dev Tip: Animating Attached Properties<p>When you're working with Metro Style apps, eventually you'll want to animate an <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh758282.aspx">attached property</a>. A common example is changing which grid row or column an element is in when reacting to a layout change.</p>
<p>Let's give it a try:</p>
<pre><code><VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="FullScreenLandscape" />
<VisualState x:Name="Filled" />
<VisualState x:Name="FullScreenPortrait" />
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridItem"
Storyboard.TargetProperty="Grid.Column">
<DiscreteObjectKeyFrame KeyTime="0"
Value="0" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</code></pre>
<p>Oops! That didn't work:</p>
<p><img src="https://www.danrigby.com/images/animate-attachedproperty-error.png" alt="Error" /></p>
<p>So what's the secret sauce for Attached Properties? <strong>Parentheses</strong>.</p>
<p>So let's try again:</p>
<pre><code><VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="FullScreenLandscape" />
<VisualState x:Name="Filled" />
<VisualState x:Name="FullScreenPortrait" />
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridItem"
Storyboard.TargetProperty="(Grid.Column)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="0" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</code></pre>
<p>No more errors!</p>
2012-07-18T04:00:00Z2012-07-18T04:00:00ZDan Rigby<p>When you're working with Metro Style apps, eventually you'll want to animate an <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh758282.aspx">attached property</a>. A common example is changing which grid row or column an element is in when reacting to a layout change.</p>
<p>Let's give it a try:</p>
<pre><code><VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="FullScreenLandscape" />
<VisualState x:Name="Filled" />
<VisualState x:Name="FullScreenPortrait" />
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridItem"
Storyboard.TargetProperty="Grid.Column">
<DiscreteObjectKeyFrame KeyTime="0"
Value="0" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</code></pre>
<p>Oops! That didn't work:</p>
<p><img src="https://www.danrigby.com/images/animate-attachedproperty-error.png" alt="Error" /></p>
<p>So what's the secret sauce for Attached Properties? <strong>Parentheses</strong>.</p>
<p>So let's try again:</p>
<pre><code><VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="FullScreenLandscape" />
<VisualState x:Name="Filled" />
<VisualState x:Name="FullScreenPortrait" />
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridItem"
Storyboard.TargetProperty="(Grid.Column)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="0" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</code></pre>
<p>No more errors!</p>
https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/INotifyPropertyChanged, The .NET 4.5 Way - Revisited<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li>INotifyPropertyChanged, The .NET 4.5 Way - Revisited</li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p>In what is what is becoming a never ending topic on my blog, I have stumbled across yet another interesting implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a>.</p>
<p>This implementation comes to us via the C# / XAML Windows 8 Metro application project templates in the Visual Studio 11 beta. In the project templates we are given a base class which implements INotifyPropertyChanged, BindableBase. </p>
<p>Here is the class in it's entirety:</p>
<pre><code>using System.ComponentModel;
using System.Runtime.CompilerServices;
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged" /> to simplify models.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.
/// </param>
/// <returns>
/// True if the value was changed, false if the existing value matched the
/// desired value.
/// </returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value))
{
return false;
}
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute" />.
/// </param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
</code></pre>
<p>This implementation, like my <a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a> post, uses the new <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute(v=vs.110).aspx">CallerMemberName</a> attribute in .NET 4.5. Where it differs though, is rather then using the <a href="http://msdn.microsoft.com/en-us/library/ms224763.aspx">EqualityComparer<T>.Default</a> property to create a generic comparison, the code simply uses <a href="http://msdn.microsoft.com/en-us/library/w4hkze5k.aspx">Object.Equals()</a>.</p>
<p>I knew Object.Equals() checks to see if two objects have the same reference in order to determine equality. That seemed perfectly acceptable to me. But what about value types?</p>
<p>Turns out, Object.Equals() handles those in a generic, but clever way:</p>
<blockquote>The default implementation of Equals supports reference equality for reference types, and <strong>bitwise equality for value types</strong>. Reference equality means the object references that are compared refer to the same object. <strong>Bitwise equality means the objects that are compared have the same binary representation</strong>.</blockquote>
<p>This is a lot less complicated (and most likely faster) then using EqualityComparer<T>.Default. There is, however, a subtle difference here in behaviour. Using EqualityComparer<T>.Default will do the following:</p>
<blockquote>The Default property checks whether type T implements the <a href="http://msdn.microsoft.com/en-us/library/ms131187.aspx" target="_blank">System.IEquatable(Of T)</a> interface and, if so, returns an <a href="http://msdn.microsoft.com/en-us/library/ms132123.aspx" target="_blank">EqualityComparer(Of T)</a> that uses that implementation. Otherwise, it returns an EqualityComparer(Of T) that uses the overrides of <a href="http://msdn.microsoft.com/en-us/library/system.object.equals.aspx" target="_blank">Object.Equals</a> and <a href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" target="_blank">Object.GetHashCode</a> provided by T.</blockquote>
<p>So if you have custom equality comparisons implemented for some of your types, the EqualityComparer<T>.Default approach will most likely serve you better.</p>
<p>The one other distinct difference this INotifyPropertyChanged implementation has over all of my previous examples, is that SetProperty<T>() returns true or false based on whether or not the value was updated. This can be very useful if you have more sophisticated property logic that needs to do more then just raise the event if value changes.</p>
<p>All in all, I think I like this implementation the best.</p>
2012-04-01T04:00:00Z2012-04-01T04:00:00ZDan Rigby<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li>INotifyPropertyChanged, The .NET 4.5 Way - Revisited</li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p>In what is what is becoming a never ending topic on my blog, I have stumbled across yet another interesting implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a>.</p>
<p>This implementation comes to us via the C# / XAML Windows 8 Metro application project templates in the Visual Studio 11 beta. In the project templates we are given a base class which implements INotifyPropertyChanged, BindableBase. </p>
<p>Here is the class in it's entirety:</p>
<pre><code>using System.ComponentModel;
using System.Runtime.CompilerServices;
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged" /> to simplify models.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.
/// </param>
/// <returns>
/// True if the value was changed, false if the existing value matched the
/// desired value.
/// </returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value))
{
return false;
}
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">
/// Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute" />.
/// </param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
</code></pre>
<p>This implementation, like my <a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a> post, uses the new <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute(v=vs.110).aspx">CallerMemberName</a> attribute in .NET 4.5. Where it differs though, is rather then using the <a href="http://msdn.microsoft.com/en-us/library/ms224763.aspx">EqualityComparer<T>.Default</a> property to create a generic comparison, the code simply uses <a href="http://msdn.microsoft.com/en-us/library/w4hkze5k.aspx">Object.Equals()</a>.</p>
<p>I knew Object.Equals() checks to see if two objects have the same reference in order to determine equality. That seemed perfectly acceptable to me. But what about value types?</p>
<p>Turns out, Object.Equals() handles those in a generic, but clever way:</p>
<blockquote>The default implementation of Equals supports reference equality for reference types, and <strong>bitwise equality for value types</strong>. Reference equality means the object references that are compared refer to the same object. <strong>Bitwise equality means the objects that are compared have the same binary representation</strong>.</blockquote>
<p>This is a lot less complicated (and most likely faster) then using EqualityComparer<T>.Default. There is, however, a subtle difference here in behaviour. Using EqualityComparer<T>.Default will do the following:</p>
<blockquote>The Default property checks whether type T implements the <a href="http://msdn.microsoft.com/en-us/library/ms131187.aspx" target="_blank">System.IEquatable(Of T)</a> interface and, if so, returns an <a href="http://msdn.microsoft.com/en-us/library/ms132123.aspx" target="_blank">EqualityComparer(Of T)</a> that uses that implementation. Otherwise, it returns an EqualityComparer(Of T) that uses the overrides of <a href="http://msdn.microsoft.com/en-us/library/system.object.equals.aspx" target="_blank">Object.Equals</a> and <a href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" target="_blank">Object.GetHashCode</a> provided by T.</blockquote>
<p>So if you have custom equality comparisons implemented for some of your types, the EqualityComparer<T>.Default approach will most likely serve you better.</p>
<p>The one other distinct difference this INotifyPropertyChanged implementation has over all of my previous examples, is that SetProperty<T>() returns true or false based on whether or not the value was updated. This can be very useful if you have more sophisticated property logic that needs to do more then just raise the event if value changes.</p>
<p>All in all, I think I like this implementation the best.</p>
https://www.danrigby.com/2012/03/22/how-to-launch-git-extensions-from-git-bash-on-windows/How to launch Git Extensions from Git Bash on Windows<p>Typically when I'm working on a piece of software, I leave an <a href="http://code.google.com/p/msysgit/">msysgit</a> bash prompt open in the current project directory. Over time I've come to prefer using the command line for some git operations (clone, fetch, pull, rebase, push, checkout, branching) and the <a href="http://code.google.com/p/gitextensions/">Git Extensions</a> UI for others (commit, view log, examining prior commit details, diffing).</p>
<p>For various esoteric and obsessive compulsive reasons, I don't like installing shell extensions and I don't like leaving Git Extensions sitting open all the time. This setup makes launching Git Extensions a bit tedious (go find the shortcut, double-click it, wait for it to open, tell it to open the git repository I'm working out of...), especially when I find myself needing to do this repeatedly in a short period of time.</p>
<p>What I want then, is to be able to launch Git Extensions just like gitk, from the git bash shell. Fortunately, this is relatively simple to accomplish.</p>
<p>What you need to do first is open your text editor of choice using run as an administrator. Then paste the following into a new file:</p>
<pre><code>#!/bin/sh
"$PROGRAMFILES\GitExtensions\GitExtensions.exe" "$@" &
</code></pre>
<p>You will need to adjust the path to match your Git Extensions installation directory if you did not install it in the default location.</p>
<p>Save the file as "git-ex" with no extension in the msysgit bin folder. This will be either "C:\Program Files (x86)\Git\bin" if you're running 64 bit Windows or "C:\Program Files\Git\bin" if you're running 32 bit Windows.</p>
<p>Fire up a new instance of git bash, and type "git ex". Git Extensions should open straight to the current repository:
<img src="https://www.danrigby.com/images/gitex-launch.png" alt="Screenshot of git bash and git extensions" /></p>
<p>You can also include Git Extensions command line arguments in order to jump straight to specific command windows.
For example, typing "git ex commit", will open the Git Extensions commit dialog:
<img src="https://www.danrigby.com/images/gitex-commit.png" alt="Screenshot of git bash and git extensions commit dialog" /></p>
<p>And if your're wondering precisely what Git Extensions command line options are at your disposal, here they are:</p>
<pre><code>browse
add
addfiles
apply
applypatch
branch
checkout
checkoutbranch
checkoutrevision
cleanup
clone [path]
commit [--quiet]
filehistory [file]
formatpatch
init
pull [--rebase] [--merge] [--fetch] [--quiet]
push [--quiet]
settings
viewdiff
rebase [--branch name]
marge [--branch name]
cherry
tag
stash
synchronize [--rebase] [--merge] [--fetch] [--quiet]
</code></pre>
<p>And that's it. Now you can revel in your newly found git bash Git Extensions launching command line glory.</p>
<p>UPDATED (2012-03-24): Changed bash script to use $PROGRAMFILES environment variable & changed script name to git-ex based on feedback from Pat Thoyts.</p>
2012-03-22T04:00:00Z2012-03-22T04:00:00ZDan Rigby<p>Typically when I'm working on a piece of software, I leave an <a href="http://code.google.com/p/msysgit/">msysgit</a> bash prompt open in the current project directory. Over time I've come to prefer using the command line for some git operations (clone, fetch, pull, rebase, push, checkout, branching) and the <a href="http://code.google.com/p/gitextensions/">Git Extensions</a> UI for others (commit, view log, examining prior commit details, diffing).</p>
<p>For various esoteric and obsessive compulsive reasons, I don't like installing shell extensions and I don't like leaving Git Extensions sitting open all the time. This setup makes launching Git Extensions a bit tedious (go find the shortcut, double-click it, wait for it to open, tell it to open the git repository I'm working out of...), especially when I find myself needing to do this repeatedly in a short period of time.</p>
<p>What I want then, is to be able to launch Git Extensions just like gitk, from the git bash shell. Fortunately, this is relatively simple to accomplish.</p>
<p>What you need to do first is open your text editor of choice using run as an administrator. Then paste the following into a new file:</p>
<pre><code>#!/bin/sh
"$PROGRAMFILES\GitExtensions\GitExtensions.exe" "$@" &
</code></pre>
<p>You will need to adjust the path to match your Git Extensions installation directory if you did not install it in the default location.</p>
<p>Save the file as "git-ex" with no extension in the msysgit bin folder. This will be either "C:\Program Files (x86)\Git\bin" if you're running 64 bit Windows or "C:\Program Files\Git\bin" if you're running 32 bit Windows.</p>
<p>Fire up a new instance of git bash, and type "git ex". Git Extensions should open straight to the current repository:
<img src="https://www.danrigby.com/images/gitex-launch.png" alt="Screenshot of git bash and git extensions" /></p>
<p>You can also include Git Extensions command line arguments in order to jump straight to specific command windows.
For example, typing "git ex commit", will open the Git Extensions commit dialog:
<img src="https://www.danrigby.com/images/gitex-commit.png" alt="Screenshot of git bash and git extensions commit dialog" /></p>
<p>And if your're wondering precisely what Git Extensions command line options are at your disposal, here they are:</p>
<pre><code>browse
add
addfiles
apply
applypatch
branch
checkout
checkoutbranch
checkoutrevision
cleanup
clone [path]
commit [--quiet]
filehistory [file]
formatpatch
init
pull [--rebase] [--merge] [--fetch] [--quiet]
push [--quiet]
settings
viewdiff
rebase [--branch name]
marge [--branch name]
cherry
tag
stash
synchronize [--rebase] [--merge] [--fetch] [--quiet]
</code></pre>
<p>And that's it. Now you can revel in your newly found git bash Git Extensions launching command line glory.</p>
<p>UPDATED (2012-03-24): Changed bash script to use $PROGRAMFILES environment variable & changed script name to git-ex based on feedback from Pat Thoyts.</p>
https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/INotifyPropertyChanged, The .NET 4.5 Way<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li>INotifyPropertyChanged, The .NET 4.5 Way</li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">Previously I discussed</a> a novel new way of implementing <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a> based on code I saw during a Build session.</p>
<p>As of yesterday, February 29th, <a href="https://www.danrigby.com/?p=484">the Visual Studio 11 & .NET 4.5 Betas are out</a>, and included in the <a href="http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx">.NET 4.5 Beta</a> comes a handy new feature, the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute(v=vs.110).aspx">CallerMemberName</a> attribute. It is one of three new <a href="http://msdn.microsoft.com/en-us/library/hh534540(VS.110).aspx">Caller Information</a> attributes that have been added in this .NET Framework release. </p>
<p>It is joined by the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callerfilepathattribute(v=vs.110).aspx">CallerFilePath</a> and <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callerlinenumberattribute(v=vs.110).aspx">CallerLineNumber</a> attributes. These attributes tell the compiler to include information about the caller as a parameter when compiling a method call (<a href="http://rohiton.net/2012/03/05/caller-information/">there's no runtime logic involved</a>).</p>
<p>With this new functionality we can code things like logging & tracing routines and INotifyPropertyChanged implementations without having to use <a href="http://stackoverflow.com/q/1039505/53777">string literals</a>, <a href="http://stackoverflow.com/a/143611/53777">slow reflection code</a>, <a href="http://stackoverflow.com/q/6829099/53777">complex expression tree logic</a>, or <a href="http://code.google.com/p/notifypropertyweaver/">code weaving</a>.</p>
<p>Leveraging CallerMemberName, we can now rewrite our <a href="https://www.danrigby.com/?p=452">previous implementation</a> as the following:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, [CallerMemberName] string name = "")
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
private int unitsInStock;
public int UnitsInStock
{
get { return unitsInStock; }
set
{
SetProperty(ref unitsInStock, value);
}
}
</code></pre>
<p>Fast, clean, maintainable, and no outside dependencies!</p>
<p>Last, but not least, for those of you who may <a href="http://channel9.msdn.com/Shows/This+Week+On+Channel+9/TWC9-Jan-13-2012#time=8m14s">prefer a more conventional INotifyPropertyChanged approach</a>, the updated <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx">.NET 4.5 MSDN documentation page for INotifyPropertyChanged</a> uses the CallerMemberName attribute in it's implementation example. (-;</p>
2012-03-01T05:00:00Z2012-03-01T05:00:00ZDan Rigby<p>This article is part of a series:</p>
<ol>
<li><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">INotifyPropertyChanged, The Anders Hejlsberg Way</a></li>
<li>INotifyPropertyChanged, The .NET 4.5 Way</li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p><a href="https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/">Previously I discussed</a> a novel new way of implementing <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a> based on code I saw during a Build session.</p>
<p>As of yesterday, February 29th, <a href="https://www.danrigby.com/?p=484">the Visual Studio 11 & .NET 4.5 Betas are out</a>, and included in the <a href="http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx">.NET 4.5 Beta</a> comes a handy new feature, the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute(v=vs.110).aspx">CallerMemberName</a> attribute. It is one of three new <a href="http://msdn.microsoft.com/en-us/library/hh534540(VS.110).aspx">Caller Information</a> attributes that have been added in this .NET Framework release. </p>
<p>It is joined by the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callerfilepathattribute(v=vs.110).aspx">CallerFilePath</a> and <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callerlinenumberattribute(v=vs.110).aspx">CallerLineNumber</a> attributes. These attributes tell the compiler to include information about the caller as a parameter when compiling a method call (<a href="http://rohiton.net/2012/03/05/caller-information/">there's no runtime logic involved</a>).</p>
<p>With this new functionality we can code things like logging & tracing routines and INotifyPropertyChanged implementations without having to use <a href="http://stackoverflow.com/q/1039505/53777">string literals</a>, <a href="http://stackoverflow.com/a/143611/53777">slow reflection code</a>, <a href="http://stackoverflow.com/q/6829099/53777">complex expression tree logic</a>, or <a href="http://code.google.com/p/notifypropertyweaver/">code weaving</a>.</p>
<p>Leveraging CallerMemberName, we can now rewrite our <a href="https://www.danrigby.com/?p=452">previous implementation</a> as the following:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, [CallerMemberName] string name = "")
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
private int unitsInStock;
public int UnitsInStock
{
get { return unitsInStock; }
set
{
SetProperty(ref unitsInStock, value);
}
}
</code></pre>
<p>Fast, clean, maintainable, and no outside dependencies!</p>
<p>Last, but not least, for those of you who may <a href="http://channel9.msdn.com/Shows/This+Week+On+Channel+9/TWC9-Jan-13-2012#time=8m14s">prefer a more conventional INotifyPropertyChanged approach</a>, the updated <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx">.NET 4.5 MSDN documentation page for INotifyPropertyChanged</a> uses the CallerMemberName attribute in it's implementation example. (-;</p>
https://www.danrigby.com/2012/02/29/windows-8-customer-preview-visual-studio-11-beta-net-4-5-beta-download-links/Windows 8 Customer Preview / Visual Studio 11 Beta / .NET 4.5 Beta Download Links<p>The Windows 8 Customer Preview is upon us!</p>
<p>Joining the party are the Visual Studio 11 and .NET 4.5 Betas along with the Windows Server 8 Beta.</p>
<p>Links:</p>
<ul>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/consumer-preview">Windows 8 Customer Preview - Main Site</a></p>
</li>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/download">Windows 8 Customer Preview - Setup</a></p>
</li>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/iso">Windows 8 Customer Preview - ISOs</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us">Visual Studio 11 Beta - Main Site</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#ultimate">Visual Studio 11 Beta - Ultimate</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#vs-sdk">Visual Studio 11 Beta - Visual Studio SDK</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#net-45">Visual Studio 11 Beta - .NET 4.5</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/en-us/server-cloud/windows-server/v8-default.aspx">Windows 8 Server Beta - Main Site</a></p>
</li>
<li>
<p><a href="http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx">Windows 8 Server Beta - Download</a> (MSDN Subscribers Only)</p>
</li>
</ul>
<p><strong>Note:</strong> To install the Windows 8 Customer Preview from an ISO image, you will still need to run the Setup download in order to get a product key.</p>
<p>Happy downloading!</p>
<p><strong>Update (2012-03-06):</strong> Zain Naboulsi has posted a fairly awesome (and much more complete) <a href="http://blogs.msdn.com/b/zainnab/archive/2012/03/06/windows-8-consumer-preview-the-ultimate-link-list.aspx">Windows 8 Consumer Preview link list</a> on the <a href="http://blogs.msdn.com/b/zainnab/">Visual Studio Tips and Tricks Blog</a>.</p>
2012-02-29T05:00:00Z2012-02-29T05:00:00ZDan Rigby<p>The Windows 8 Customer Preview is upon us!</p>
<p>Joining the party are the Visual Studio 11 and .NET 4.5 Betas along with the Windows Server 8 Beta.</p>
<p>Links:</p>
<ul>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/consumer-preview">Windows 8 Customer Preview - Main Site</a></p>
</li>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/download">Windows 8 Customer Preview - Setup</a></p>
</li>
<li>
<p><a href="http://windows.microsoft.com/en-US/windows-8/iso">Windows 8 Customer Preview - ISOs</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us">Visual Studio 11 Beta - Main Site</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#ultimate">Visual Studio 11 Beta - Ultimate</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#vs-sdk">Visual Studio 11 Beta - Visual Studio SDK</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/visualstudio/11/en-us/downloads#net-45">Visual Studio 11 Beta - .NET 4.5</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/en-us/server-cloud/windows-server/v8-default.aspx">Windows 8 Server Beta - Main Site</a></p>
</li>
<li>
<p><a href="http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx">Windows 8 Server Beta - Download</a> (MSDN Subscribers Only)</p>
</li>
</ul>
<p><strong>Note:</strong> To install the Windows 8 Customer Preview from an ISO image, you will still need to run the Setup download in order to get a product key.</p>
<p>Happy downloading!</p>
<p><strong>Update (2012-03-06):</strong> Zain Naboulsi has posted a fairly awesome (and much more complete) <a href="http://blogs.msdn.com/b/zainnab/archive/2012/03/06/windows-8-consumer-preview-the-ultimate-link-list.aspx">Windows 8 Consumer Preview link list</a> on the <a href="http://blogs.msdn.com/b/zainnab/">Visual Studio Tips and Tricks Blog</a>.</p>
https://www.danrigby.com/2012/01/08/inotifypropertychanged-the-anders-hejlsberg-way/INotifyPropertyChanged, The Anders Hejlsberg Way<p>This article is part of a series:</p>
<ol>
<li>INotifyPropertyChanged, The Anders Hejlsberg Way</li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p>Back in September I was watching the <a href="http://www.buildwindows.com/">Build</a> session that <a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg">Anders Hejlsberg</a> was giving on the <a href="http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-816T">Future directions for C# and Visual Basic</a> and something small but interesting stood out to me in the demo code he used.</p>
<p>We're all pretty used to the standard boilerplate implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a> that goes like this:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
private string companyNameValue = String.Empty;
public string CompanyName
{
get { return this.companyNameValue; }
set
{
if (value != this.companyNameValue)
{
this.companyNameValue = value;
NotifyPropertyChanged("CompanyName");
}
}
}
</code></pre>
<p>The above code is taken directly from the MSDN article on "<a href="http://msdn.microsoft.com/en-us/library/ms229614.aspx">How to: Implement the INotifyPropertyChanged Interface</a>". What jumped out at me in Anders code, was that he was doing the check for equality in the helper method and not the property itself. The thought of doing this had crossed my mind before, but how could you create a method that could check for equality <em>for any given type</em>?</p>
<p>Enter the <a href="http://msdn.microsoft.com/en-us/library/ms224763.aspx">EqualityComparer<T>.Default</a> property.</p>
<p>Using the <a href="http://msdn.microsoft.com/en-us/library/ms132128.aspx">Equals()</a> method on EqualityComparer<T>.Default we can now create a generic method that compares the equality of two instances of any give type. This gives rise to the following INotifyPropertyChanged implementation that Anders used in his session:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, string name)
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
private int unitsInStock;
public int UnitsInStock
{
get { return unitsInStock; }
set
{
SetProperty(ref unitsInStock, value, "UnitsInStock");
}
}
</code></pre>
<p>This not only reduces the property set implementation down to 1 line in most cases, but sets up a <a href="http://www.codinghorror.com/blog/2007/08/falling-into-the-pit-of-success.html">Pit of Success</a> for properly implementing INotifyPropertyChanged in a class/subclass's properties.</p>
<p>Nice.</p>
<p>(Bonus points for anyone who realized the current MSDN example code isn't thread safe and contains a <a href="http://blogs.msdn.com/b/ericlippert/archive/2009/04/29/events-and-races.aspx">Race Condition</a>.)</p>
2012-01-08T05:00:00Z2012-01-08T05:00:00ZDan Rigby<p>This article is part of a series:</p>
<ol>
<li>INotifyPropertyChanged, The Anders Hejlsberg Way</li>
<li><a href="https://www.danrigby.com/2012/03/01/inotifypropertychanged-the-net-4-5-way/">INotifyPropertyChanged, The .NET 4.5 Way</a></li>
<li><a href="https://www.danrigby.com/2012/04/01/inotifypropertychanged-the-net-4-5-way-revisited/">INotifyPropertyChanged, The .NET 4.5 Way - Revisited</a></li>
<li><a href="https://www.danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/">INotifyPropertyChanged, The .NET 4.6 Way</a></li>
</ol>
<hr />
<p>Back in September I was watching the <a href="http://www.buildwindows.com/">Build</a> session that <a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg">Anders Hejlsberg</a> was giving on the <a href="http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-816T">Future directions for C# and Visual Basic</a> and something small but interesting stood out to me in the demo code he used.</p>
<p>We're all pretty used to the standard boilerplate implementation of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx">INotifyPropertyChanged</a> that goes like this:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
private string companyNameValue = String.Empty;
public string CompanyName
{
get { return this.companyNameValue; }
set
{
if (value != this.companyNameValue)
{
this.companyNameValue = value;
NotifyPropertyChanged("CompanyName");
}
}
}
</code></pre>
<p>The above code is taken directly from the MSDN article on "<a href="http://msdn.microsoft.com/en-us/library/ms229614.aspx">How to: Implement the INotifyPropertyChanged Interface</a>". What jumped out at me in Anders code, was that he was doing the check for equality in the helper method and not the property itself. The thought of doing this had crossed my mind before, but how could you create a method that could check for equality <em>for any given type</em>?</p>
<p>Enter the <a href="http://msdn.microsoft.com/en-us/library/ms224763.aspx">EqualityComparer<T>.Default</a> property.</p>
<p>Using the <a href="http://msdn.microsoft.com/en-us/library/ms132128.aspx">Equals()</a> method on EqualityComparer<T>.Default we can now create a generic method that compares the equality of two instances of any give type. This gives rise to the following INotifyPropertyChanged implementation that Anders used in his session:</p>
<pre><code>public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, string name)
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
private int unitsInStock;
public int UnitsInStock
{
get { return unitsInStock; }
set
{
SetProperty(ref unitsInStock, value, "UnitsInStock");
}
}
</code></pre>
<p>This not only reduces the property set implementation down to 1 line in most cases, but sets up a <a href="http://www.codinghorror.com/blog/2007/08/falling-into-the-pit-of-success.html">Pit of Success</a> for properly implementing INotifyPropertyChanged in a class/subclass's properties.</p>
<p>Nice.</p>
<p>(Bonus points for anyone who realized the current MSDN example code isn't thread safe and contains a <a href="http://blogs.msdn.com/b/ericlippert/archive/2009/04/29/events-and-races.aspx">Race Condition</a>.)</p>
https://www.danrigby.com/2011/12/30/winmerge-not-quite-dead-yet/WinMerge: Not Quite Dead Yet<p>Every few months or so I go looking for another free diff tool that I like as much as <a href="http://winmerge.org/">WinMerge</a> (usually in vain) since WM hasn't released a new version in over 2 years. <a href="https://bitbucket.org/grimmdp/winmerge">WinMerge 3</a>, while having been in planning for almost as long, still hasn't seen any real development traction.</p>
<p>Today however, I was surprised to stumble across a fork of the WinMerge 2 code base that seems to be in active development under the name of <a href="http://sourceforge.net/apps/phpbb/winmerge/viewtopic.php?f=4&t=352">WinMerge 2011</a>. There have been a couple of releases so far and the developer seems to be one of the WinMerge developers (<a href="http://sourceforge.net/users/jtuc">Jochen Tucht</a>) as they have commits in the official <a href="http://winmerge.svn.sourceforge.net/">WinMerge SVN repository</a>.</p>
<p>By all appearances this seems to be a promising development and I hope the developer keeps with it. WinMerge has been my favorite diff/merge tool for quite some time with only <a href="http://www.perforce.com/product/components/perforce_visual_merge_and_diff_tools">P4Merge</a> giving it competition.</p>
<p>You can download the latest version of WinMerge 2011 from here: <a href="https://bitbucket.org/jtuc/winmerge2011/downloads">https://bitbucket.org/jtuc/winmerge2011/downloads</a></p>
2011-12-30T05:00:00Z2011-12-30T05:00:00ZDan Rigby<p>Every few months or so I go looking for another free diff tool that I like as much as <a href="http://winmerge.org/">WinMerge</a> (usually in vain) since WM hasn't released a new version in over 2 years. <a href="https://bitbucket.org/grimmdp/winmerge">WinMerge 3</a>, while having been in planning for almost as long, still hasn't seen any real development traction.</p>
<p>Today however, I was surprised to stumble across a fork of the WinMerge 2 code base that seems to be in active development under the name of <a href="http://sourceforge.net/apps/phpbb/winmerge/viewtopic.php?f=4&t=352">WinMerge 2011</a>. There have been a couple of releases so far and the developer seems to be one of the WinMerge developers (<a href="http://sourceforge.net/users/jtuc">Jochen Tucht</a>) as they have commits in the official <a href="http://winmerge.svn.sourceforge.net/">WinMerge SVN repository</a>.</p>
<p>By all appearances this seems to be a promising development and I hope the developer keeps with it. WinMerge has been my favorite diff/merge tool for quite some time with only <a href="http://www.perforce.com/product/components/perforce_visual_merge_and_diff_tools">P4Merge</a> giving it competition.</p>
<p>You can download the latest version of WinMerge 2011 from here: <a href="https://bitbucket.org/jtuc/winmerge2011/downloads">https://bitbucket.org/jtuc/winmerge2011/downloads</a></p>
https://www.danrigby.com/2011/12/15/wpf-tools/WPF Tools<p>Went in search of new WPF tools today to support some debugging/performance work I was doing in a large WPF application. I was pleasantly surprised to come across a few new ones that I wasn't aware of.</p>
<p>These are the WPF tools that I know about and use on a periodic basis:</p>
<p><strong>Free Tools:</strong></p>
<ul>
<li>
<p><a href="http://kaxaml.com/">Kaxaml</a></p>
<blockquote>Kaxaml is a lightweight XAML editor that gives you a "split view" so you can see both your XAML and your rendered content (kind of like XamlPad but without the gigabyte of SDK).Kaxaml is designed to be "notepad for XAML." It's simple and lightweight and makes it easy to just try something out. It also has some basic support for intellisense and some fun plugins (including one for snippets, one for cleaning up your XAML and for rendering your XAML to an image).</blockquote>
</li>
<li>
<p><a href="http://www.granthinkson.com/2007/11/08/announcing-pistachio-wpf-resource-visualizer/">Pistachio</a></p>
<blockquote>Pistachio is a utility I created with fellow Infragistics VDGer Tim Hussey. It’s pretty simple really, you just open a .csproj file with Pistachio and it identifies all resources defined within the project, then shows you which of those resources are used and where they’re used.</blockquote>
</li>
<li>
<p><a href="http://snoopwpf.codeplex.com/">Snoop</a></p>
<blockquote>"Snoop ... the WPF utility by Pete Blois and now maintained by Cory Plotts that allows you to spy/browse the visual tree and change properties ... amongst other things.</blockquote>
</li>
<li>
<p><a href="http://wpfinspector.codeplex.com/">WPF Inspector</a></p>
<blockquote>WPF Inspector is a utility that attaches to a running WPF application to troubleshoot common problems with layouting, databinding or styling. WPF Inspector allows you to explore a live view of the logical- and visual tree, read and edit property values of elements, watch the data context, debug triggers, trace styles and much more.</blockquote>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/aa969767.aspx">WPF Performance Suite</a></p>
<blockquote>The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you can apply. The WPF Performance Suite includes performance profiling tools called Perforator and Visual Profiler.</blockquote>
</li>
<li>
<p><a href="http://wpftutorial.net/GeometryTransformer.html">WPF Geometry Transformation Tool</a></p>
<blockquote>The geometry transformer is a simple tool to scale-, translate- and rotate-transform a geometry in the path mini language. Simply paste the geometry string into the input textbox and specify the transform parameters. After pressing "Transform" the output textbox shows the translated geometry string.</blockquote>
</li>
</ul>
<p><strong>Paid Tools:</strong></p>
<ul>
<li>
<a href="http://www.molosoft.com/">Mole 2010</a>
<blockquote>Mole is a debugging tool for .NET developers. It can be opened in Visual Studio 2010 while you are stepping through your source code after hitting a breakpoint. Mole was implemented as a custom debugger visualizer so that you can easily use it just like any other visualizer available in Visual Studio. With it you can navigate object graphs, view collection data, inspect visual elements, drill into data bindings, sort and filter object properties, compare object snapshots, and more.</blockquote>
</li>
</ul>
2011-12-15T05:00:00Z2011-12-15T05:00:00ZDan Rigby<p>Went in search of new WPF tools today to support some debugging/performance work I was doing in a large WPF application. I was pleasantly surprised to come across a few new ones that I wasn't aware of.</p>
<p>These are the WPF tools that I know about and use on a periodic basis:</p>
<p><strong>Free Tools:</strong></p>
<ul>
<li>
<p><a href="http://kaxaml.com/">Kaxaml</a></p>
<blockquote>Kaxaml is a lightweight XAML editor that gives you a "split view" so you can see both your XAML and your rendered content (kind of like XamlPad but without the gigabyte of SDK).Kaxaml is designed to be "notepad for XAML." It's simple and lightweight and makes it easy to just try something out. It also has some basic support for intellisense and some fun plugins (including one for snippets, one for cleaning up your XAML and for rendering your XAML to an image).</blockquote>
</li>
<li>
<p><a href="http://www.granthinkson.com/2007/11/08/announcing-pistachio-wpf-resource-visualizer/">Pistachio</a></p>
<blockquote>Pistachio is a utility I created with fellow Infragistics VDGer Tim Hussey. It’s pretty simple really, you just open a .csproj file with Pistachio and it identifies all resources defined within the project, then shows you which of those resources are used and where they’re used.</blockquote>
</li>
<li>
<p><a href="http://snoopwpf.codeplex.com/">Snoop</a></p>
<blockquote>"Snoop ... the WPF utility by Pete Blois and now maintained by Cory Plotts that allows you to spy/browse the visual tree and change properties ... amongst other things.</blockquote>
</li>
<li>
<p><a href="http://wpfinspector.codeplex.com/">WPF Inspector</a></p>
<blockquote>WPF Inspector is a utility that attaches to a running WPF application to troubleshoot common problems with layouting, databinding or styling. WPF Inspector allows you to explore a live view of the logical- and visual tree, read and edit property values of elements, watch the data context, debug triggers, trace styles and much more.</blockquote>
</li>
<li>
<p><a href="http://msdn.microsoft.com/en-us/library/aa969767.aspx">WPF Performance Suite</a></p>
<blockquote>The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you can apply. The WPF Performance Suite includes performance profiling tools called Perforator and Visual Profiler.</blockquote>
</li>
<li>
<p><a href="http://wpftutorial.net/GeometryTransformer.html">WPF Geometry Transformation Tool</a></p>
<blockquote>The geometry transformer is a simple tool to scale-, translate- and rotate-transform a geometry in the path mini language. Simply paste the geometry string into the input textbox and specify the transform parameters. After pressing "Transform" the output textbox shows the translated geometry string.</blockquote>
</li>
</ul>
<p><strong>Paid Tools:</strong></p>
<ul>
<li>
<a href="http://www.molosoft.com/">Mole 2010</a>
<blockquote>Mole is a debugging tool for .NET developers. It can be opened in Visual Studio 2010 while you are stepping through your source code after hitting a breakpoint. Mole was implemented as a custom debugger visualizer so that you can easily use it just like any other visualizer available in Visual Studio. With it you can navigate object graphs, view collection data, inspect visual elements, drill into data bindings, sort and filter object properties, compare object snapshots, and more.</blockquote>
</li>
</ul>
https://www.danrigby.com/2010/03/03/quick-and-easy-google-or-bing-web-search-in-visual-studio/Quick and Easy Google (or Bing) Web Search in Visual Studio<p><strong>Here is a quick and easy way to add a Google (or Bing) Web Search link to the context menu in Visual Studio:</strong></p>
<ul>
<li>Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE (or pressing Alt+F11).</li>
</ul>
<p>- Right click on “MyMacros” and select Add New –> Add New Item.</p>
<p>- Select the Module template, name the module “Search”, and click Add.</p>
<p>- Paste the following code directly before the “End Module” line:</p>
<pre><code>Sub Search()
Dim strUrl As String
Dim selection As TextSelection = DTE.ActiveDocument.Selection()
If selection.Text <> "" Then
strUrl = "www.google.com/search?q=" + selection.Text
' strUrl = "www.bing.com/search?q=" + selection.Text
DTE.ExecuteCommand("View.URL", strUrl)
Else
MsgBox("Select Text first to Search")
End If
End Sub
</code></pre>
<p>- (Optional) If you prefer to use Bing for your search, uncomment the Bing line and comment out the Google line.</p>
<p>- Your macro editor window should now look something like this:</p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-1.png" alt="Screenshot of Macro Code" /></p>
<p>- Save and close the Macro Editor window and IDE.</p>
<p>- Right click on the Visual Studio toolbar and select Customize.</p>
<p>- Under the Toolbars tab, check the Context Menus option and the switch to the Commands tab.</p>
<p>- Select the Macros Category, and then select the “MyMacros.Search.Search” macro.</p>
<p>- Drag the selected macro onto “Editor Context Menus” -> “Code Window” and then drop it where you want it in the context menu (I place mine below the Paste command).</p>
<p>- Right click on the new context menu item and change it’s name to “&Web Search”.</p>
<p>- Click close on the Customize window.</p>
<p>- You are now done! If everything has gone according to plan, when viewing a source code file you should now see a new context menu item that will do a web search on any selected text when you click it:</p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-2.png" alt="Screenshot of Context Menu" /></p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-3.png" alt="Screenshot of Search Result in VS" /></p>
2010-03-03T05:00:00Z2010-03-03T05:00:00ZDan Rigby<p><strong>Here is a quick and easy way to add a Google (or Bing) Web Search link to the context menu in Visual Studio:</strong></p>
<ul>
<li>Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE (or pressing Alt+F11).</li>
</ul>
<p>- Right click on “MyMacros” and select Add New –> Add New Item.</p>
<p>- Select the Module template, name the module “Search”, and click Add.</p>
<p>- Paste the following code directly before the “End Module” line:</p>
<pre><code>Sub Search()
Dim strUrl As String
Dim selection As TextSelection = DTE.ActiveDocument.Selection()
If selection.Text <> "" Then
strUrl = "www.google.com/search?q=" + selection.Text
' strUrl = "www.bing.com/search?q=" + selection.Text
DTE.ExecuteCommand("View.URL", strUrl)
Else
MsgBox("Select Text first to Search")
End If
End Sub
</code></pre>
<p>- (Optional) If you prefer to use Bing for your search, uncomment the Bing line and comment out the Google line.</p>
<p>- Your macro editor window should now look something like this:</p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-1.png" alt="Screenshot of Macro Code" /></p>
<p>- Save and close the Macro Editor window and IDE.</p>
<p>- Right click on the Visual Studio toolbar and select Customize.</p>
<p>- Under the Toolbars tab, check the Context Menus option and the switch to the Commands tab.</p>
<p>- Select the Macros Category, and then select the “MyMacros.Search.Search” macro.</p>
<p>- Drag the selected macro onto “Editor Context Menus” -> “Code Window” and then drop it where you want it in the context menu (I place mine below the Paste command).</p>
<p>- Right click on the new context menu item and change it’s name to “&Web Search”.</p>
<p>- Click close on the Customize window.</p>
<p>- You are now done! If everything has gone according to plan, when viewing a source code file you should now see a new context menu item that will do a web search on any selected text when you click it:</p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-2.png" alt="Screenshot of Context Menu" /></p>
<p><img src="https://www.danrigby.com/images/visualstudio-websearch-macro-3.png" alt="Screenshot of Search Result in VS" /></p>
https://www.danrigby.com/2009/10/04/automatically-cancelling-a-failed-build-in-visual-studio/Automatically Cancelling a Failed Build in Visual Studio<p>Stumbled across <a href="http://www.ehow.com/how_5025041_automatically-visual-studio-build-error.html">this little tip</a> on how to automatically cancel a build in progress after getting an error. You normally have to wait for visual studio to try to finish building all of the remaining projects before getting a chance to fix an the issue and this can take a few minutes if you have a lot of projects in your solution.</p>
<p><strong>Step 1:</strong> Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE.</p>
<p><strong>Step 2:</strong> Double click on “MyMacros” and then on “EnvironmentEvents”. You should now be looking at a VB code editor window.</p>
<p><strong>Step 3:</strong> Paste the following code directly before the “End Module” line:</p>
<pre><code>Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
If Success = False Then
DTE.ExecuteCommand("Build.Cancel")
End If
End Sub
</code></pre>
<p><strong>Step 4:</strong> Save and close the Macro Editor window and IDE.</p>
<p>All done!</p>
2009-10-04T04:00:00Z2009-10-04T04:00:00ZDan Rigby<p>Stumbled across <a href="http://www.ehow.com/how_5025041_automatically-visual-studio-build-error.html">this little tip</a> on how to automatically cancel a build in progress after getting an error. You normally have to wait for visual studio to try to finish building all of the remaining projects before getting a chance to fix an the issue and this can take a few minutes if you have a lot of projects in your solution.</p>
<p><strong>Step 1:</strong> Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE.</p>
<p><strong>Step 2:</strong> Double click on “MyMacros” and then on “EnvironmentEvents”. You should now be looking at a VB code editor window.</p>
<p><strong>Step 3:</strong> Paste the following code directly before the “End Module” line:</p>
<pre><code>Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
If Success = False Then
DTE.ExecuteCommand("Build.Cancel")
End If
End Sub
</code></pre>
<p><strong>Step 4:</strong> Save and close the Macro Editor window and IDE.</p>
<p>All done!</p>
https://www.danrigby.com/2009/04/19/retroactive-browser-compatibility/Retroactive Browser Compatibility<p>When working on an existing web application you may be placed in a situation where you need to support new browsers, or just other browsers that your app wasn’t originally coded for or tested in. In my case, this took the form of a web app developed exclusively for Internet Explorer that now needed to support other browsers. As I went through and corrected many of the browser incompatibilities, I noticed a few common ones, and wanted to mention them in case it’s beneficial to others in the same situation.</p>
<p>I should mention up front that jQuery was an indispensible tool when I was working on this project as in many cases I was able to replace the offending JavaScript with a jQuery equivalent that was cross browser compatible. If you’re a web developer and are not familiar with <a href="http://www.jquery.com">jQuery</a>, you probably should be. ;-)</p>
<p>So a couple of things to look out for… I wanted to list the easiest ones to spot first as you can do a text search and usually find all of them:</p>
<ol>
<li>
<p><strong>CSS Expressions:</strong></p>
<ul>
<li>
<p>Were implemented in IE5 and allow you to assign a JavaScript expression to a CSS property.</p>
</li>
<li>
<p>Were deprecated in IE8 standards mode, see <a href="http://blogs.msdn.com/ie/archive/2008/10/16/ending-expressions.aspx">http://blogs.msdn.com/ie/archive/2008/10/16/ending-expressions.aspx</a> for details.</p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Search for: “expression(”</p>
</li>
<li>
<p>Replace with JavaScript that dynamically modifies the CSS properties in response to specific browser events (onresize, etc).</p>
<ul>
<li>In many cases this can be more performant than CSS expressions because you can choose to bind to specific events (CSS expressions are reevaluated <em>every</em> time a JavaScript event with at least 1 listener fires.</li>
</ul>
</li>
</ul>
</li>
<li>
<p><strong>outerHTML:</strong></p>
<ul>
<li>
<p>“Get or set the HTML of the entire node x, including the outermost tag (element x itself).”</p>
</li>
<li>
<p>Example: x.outerHTML = "Let's <u>change</u> it!"</p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Search for: “outerHTML”</p>
</li>
<li>
<p>Replace with innerHTML or W3C DOM methods. innerHTML is in theory faster, but IE and Konquerer have some issues when innerHTML is used with tables. Replacing outerHTML with calls to innerHTML will also require some changes to the logic using outerHTML as innerHTML is slightly different in behavior.</p>
</li>
</ul>
</li>
<li>
<p><strong>Visual Filters:</strong></p>
<ul>
<li>
<p>Used commonly to create gradients without using images.</p>
</li>
<li>
<p>More information on Visual Filters: <a href="http://msdn.microsoft.com/en-us/library/ms532853.aspx">http://msdn.microsoft.com/en-us/library/ms532853.aspx</a></p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Example: <ELEMENT STYLE="filter:progid:DXImageTransform.Microsoft.Gradient(sProperties)" ... ></p>
</li>
<li>
<p>Search for: “DXImageTransform”</p>
</li>
<li>
<p>Replace with… Unfortunately there really isn’t an equivalent for this. Some of the visual filters can be replicated using standard CSS properties, but not all of them. As convenient as the visual filters are, they will only work in internet explorer at the moment.</p>
</li>
</ul>
</li>
<li>
<p><strong>Window.Event:</strong></p>
<ul>
<li>
<p>Used to access JavaScript event information in IE.</p>
</li>
<li>
<p>IE Specific.</p>
</li>
<li>
<p>Search for: “window.event”</p>
</li>
<li>
<p>This item could have several pages written about it, but the short story is that IE handles passing JavaScript event information differently than other browsers. You will need to code your JavaScript to accommodate this difference. jQuery can again be useful here as it can abstract a lot of this problem away from you. I recommend reading the section on events here: <a href="http://www.reloco.com.ar/mozilla/compat.html">http://www.reloco.com.ar/mozilla/compat.html</a> as it will give you an overview of the problem and how to address it.</p>
</li>
</ul>
</li>
<li>
<p><strong>Custom Attributes:</strong></p>
<ul>
<li>
<p>Used to defined custom element attributes.</p>
</li>
<li>
<p>Getting or setting custom attributes without using DOM methods is not cross browser compatible.</p>
<ul>
<li>Example: element.MyProp = “This doesn’t work in all browsers.”</li>
</ul>
</li>
<li>
<p>Search for… No good search string for these. You just need to keep your eyes out for JavaScript that makes calls to custom attributes without using DOM methods (or jQuery).</p>
</li>
<li>
<p>Replace with: calls to .getAttribute(“MyProp”) or setAttribute(“MyProp”) or if using jQuery, element.attr() as shown here: <a href="http://docs.jquery.com/Attributes/attr">http://docs.jquery.com/Attributes/attr</a>.</p>
</li>
</ul>
</li>
</ol>
<p>This list is by no means exhaustive, but I wanted to point out many of the common issues I have come across. Your mileage may vary. I recommend checking out the references listed below for a lot more good compatibility information. I’ve tried to check all of my facts, but if you notice anything that seems off, let me know so I can fix it!</p>
<p><strong>References:</strong></p>
<ul>
<li>
<p><a href="http://www.reloco.com.ar/mozilla/compat.html">http://www.reloco.com.ar/mozilla/compat.html</a> – “Making your web browser compatible with Firefox”</p>
<ul>
<li>A good overview of many of the common browser compatibility problems faced when making an web app written for IE work in Firefox</li>
</ul>
</li>
<li>
<p><a href="http://www.quirksmode.org/compatibility.html">http://www.quirksmode.org/compatibility.html</a> – “Compatibility Master Table”</p>
<ul>
<li>The holy grail of browser compatibility information. Seriously… Want to know if a browser fully supports CSS2, CSS3, DOM, etc? It’s here.</li>
</ul>
</li>
<li>
<p><a href="http://reference.sitepoint.com/">http://reference.sitepoint.com/</a> – “CSS/HTML/JavaScript Reference”</p>
<ul>
<li>Reference site for CSS, HTML, and JavaScript information. Its got a clean layout and additionally contains browser compatibility information for each of the items.</li>
</ul>
</li>
<li>
<p><a href="http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx">http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx</a> – “Site Compatibility and IE8”</p>
<ul>
<li>A page detailing potential issues and fixes for making your pages compatible with IE8 in Standards Mode. This is actually a good reference for potential cross browser problems as most of the items listed are cross browser compatibility issues as well.</li>
</ul>
</li>
</ul>
2009-04-19T04:00:00Z2009-04-19T04:00:00ZDan Rigby<p>When working on an existing web application you may be placed in a situation where you need to support new browsers, or just other browsers that your app wasn’t originally coded for or tested in. In my case, this took the form of a web app developed exclusively for Internet Explorer that now needed to support other browsers. As I went through and corrected many of the browser incompatibilities, I noticed a few common ones, and wanted to mention them in case it’s beneficial to others in the same situation.</p>
<p>I should mention up front that jQuery was an indispensible tool when I was working on this project as in many cases I was able to replace the offending JavaScript with a jQuery equivalent that was cross browser compatible. If you’re a web developer and are not familiar with <a href="http://www.jquery.com">jQuery</a>, you probably should be. ;-)</p>
<p>So a couple of things to look out for… I wanted to list the easiest ones to spot first as you can do a text search and usually find all of them:</p>
<ol>
<li>
<p><strong>CSS Expressions:</strong></p>
<ul>
<li>
<p>Were implemented in IE5 and allow you to assign a JavaScript expression to a CSS property.</p>
</li>
<li>
<p>Were deprecated in IE8 standards mode, see <a href="http://blogs.msdn.com/ie/archive/2008/10/16/ending-expressions.aspx">http://blogs.msdn.com/ie/archive/2008/10/16/ending-expressions.aspx</a> for details.</p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Search for: “expression(”</p>
</li>
<li>
<p>Replace with JavaScript that dynamically modifies the CSS properties in response to specific browser events (onresize, etc).</p>
<ul>
<li>In many cases this can be more performant than CSS expressions because you can choose to bind to specific events (CSS expressions are reevaluated <em>every</em> time a JavaScript event with at least 1 listener fires.</li>
</ul>
</li>
</ul>
</li>
<li>
<p><strong>outerHTML:</strong></p>
<ul>
<li>
<p>“Get or set the HTML of the entire node x, including the outermost tag (element x itself).”</p>
</li>
<li>
<p>Example: x.outerHTML = "Let's <u>change</u> it!"</p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Search for: “outerHTML”</p>
</li>
<li>
<p>Replace with innerHTML or W3C DOM methods. innerHTML is in theory faster, but IE and Konquerer have some issues when innerHTML is used with tables. Replacing outerHTML with calls to innerHTML will also require some changes to the logic using outerHTML as innerHTML is slightly different in behavior.</p>
</li>
</ul>
</li>
<li>
<p><strong>Visual Filters:</strong></p>
<ul>
<li>
<p>Used commonly to create gradients without using images.</p>
</li>
<li>
<p>More information on Visual Filters: <a href="http://msdn.microsoft.com/en-us/library/ms532853.aspx">http://msdn.microsoft.com/en-us/library/ms532853.aspx</a></p>
</li>
<li>
<p>IE specific.</p>
</li>
<li>
<p>Example: <ELEMENT STYLE="filter:progid:DXImageTransform.Microsoft.Gradient(sProperties)" ... ></p>
</li>
<li>
<p>Search for: “DXImageTransform”</p>
</li>
<li>
<p>Replace with… Unfortunately there really isn’t an equivalent for this. Some of the visual filters can be replicated using standard CSS properties, but not all of them. As convenient as the visual filters are, they will only work in internet explorer at the moment.</p>
</li>
</ul>
</li>
<li>
<p><strong>Window.Event:</strong></p>
<ul>
<li>
<p>Used to access JavaScript event information in IE.</p>
</li>
<li>
<p>IE Specific.</p>
</li>
<li>
<p>Search for: “window.event”</p>
</li>
<li>
<p>This item could have several pages written about it, but the short story is that IE handles passing JavaScript event information differently than other browsers. You will need to code your JavaScript to accommodate this difference. jQuery can again be useful here as it can abstract a lot of this problem away from you. I recommend reading the section on events here: <a href="http://www.reloco.com.ar/mozilla/compat.html">http://www.reloco.com.ar/mozilla/compat.html</a> as it will give you an overview of the problem and how to address it.</p>
</li>
</ul>
</li>
<li>
<p><strong>Custom Attributes:</strong></p>
<ul>
<li>
<p>Used to defined custom element attributes.</p>
</li>
<li>
<p>Getting or setting custom attributes without using DOM methods is not cross browser compatible.</p>
<ul>
<li>Example: element.MyProp = “This doesn’t work in all browsers.”</li>
</ul>
</li>
<li>
<p>Search for… No good search string for these. You just need to keep your eyes out for JavaScript that makes calls to custom attributes without using DOM methods (or jQuery).</p>
</li>
<li>
<p>Replace with: calls to .getAttribute(“MyProp”) or setAttribute(“MyProp”) or if using jQuery, element.attr() as shown here: <a href="http://docs.jquery.com/Attributes/attr">http://docs.jquery.com/Attributes/attr</a>.</p>
</li>
</ul>
</li>
</ol>
<p>This list is by no means exhaustive, but I wanted to point out many of the common issues I have come across. Your mileage may vary. I recommend checking out the references listed below for a lot more good compatibility information. I’ve tried to check all of my facts, but if you notice anything that seems off, let me know so I can fix it!</p>
<p><strong>References:</strong></p>
<ul>
<li>
<p><a href="http://www.reloco.com.ar/mozilla/compat.html">http://www.reloco.com.ar/mozilla/compat.html</a> – “Making your web browser compatible with Firefox”</p>
<ul>
<li>A good overview of many of the common browser compatibility problems faced when making an web app written for IE work in Firefox</li>
</ul>
</li>
<li>
<p><a href="http://www.quirksmode.org/compatibility.html">http://www.quirksmode.org/compatibility.html</a> – “Compatibility Master Table”</p>
<ul>
<li>The holy grail of browser compatibility information. Seriously… Want to know if a browser fully supports CSS2, CSS3, DOM, etc? It’s here.</li>
</ul>
</li>
<li>
<p><a href="http://reference.sitepoint.com/">http://reference.sitepoint.com/</a> – “CSS/HTML/JavaScript Reference”</p>
<ul>
<li>Reference site for CSS, HTML, and JavaScript information. Its got a clean layout and additionally contains browser compatibility information for each of the items.</li>
</ul>
</li>
<li>
<p><a href="http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx">http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx</a> – “Site Compatibility and IE8”</p>
<ul>
<li>A page detailing potential issues and fixes for making your pages compatible with IE8 in Standards Mode. This is actually a good reference for potential cross browser problems as most of the items listed are cross browser compatibility issues as well.</li>
</ul>
</li>
</ul>
https://www.danrigby.com/2009/02/09/official-jquery-130-131-visual-studio-intellisense-files/Official jQuery 1.3.0, 1.3.1 Visual Studio Intellisense Files<p>It looks like this weekend while I was at the <a href="http://codecamp09.fladotnet.com/">South Florida Code Camp</a> the jQuery team has posted the official jQuery 1.3.1 Visual Studio intellisense file. You can get it from the <a href="http://docs.jquery.com/Downloading_jQuery#Current_Release">jQuery downloads page</a>, or more directly from the <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.1-vsdoc.js">jQuery Google Code download page</a>.</p>
<p>The official 1.3.0 documentation was posted this weekend as well and is also available from the downloads link above, or this <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3-vsdoc.js">Google Code download page</a>.</p>
<p>Keep your eyes peeled for a jQuery 1.3.2 release anytime in the next few days as John Resig has mentioned there is still one last 1.3 regression they are working on fixing. </p>
<p>For those interested, the regression has to do with the $(document).ready() function waiting until images are fully loaded in Internet Explorer 6 & 7. The jQuery bug ticket ID is <a href="http://dev.jquery.com/ticket/3988#preview">#3988</a> and here’s a <a href="http://stackoverflow.com/questions/477463/jquery-is-waiting-for-images-to-load-before-executing-document-ready">Stack Overflow question</a> in which John Resig talks about the issue in some detail.</p>
2009-02-09T05:00:00Z2009-02-09T05:00:00ZDan Rigby<p>It looks like this weekend while I was at the <a href="http://codecamp09.fladotnet.com/">South Florida Code Camp</a> the jQuery team has posted the official jQuery 1.3.1 Visual Studio intellisense file. You can get it from the <a href="http://docs.jquery.com/Downloading_jQuery#Current_Release">jQuery downloads page</a>, or more directly from the <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.1-vsdoc.js">jQuery Google Code download page</a>.</p>
<p>The official 1.3.0 documentation was posted this weekend as well and is also available from the downloads link above, or this <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3-vsdoc.js">Google Code download page</a>.</p>
<p>Keep your eyes peeled for a jQuery 1.3.2 release anytime in the next few days as John Resig has mentioned there is still one last 1.3 regression they are working on fixing. </p>
<p>For those interested, the regression has to do with the $(document).ready() function waiting until images are fully loaded in Internet Explorer 6 & 7. The jQuery bug ticket ID is <a href="http://dev.jquery.com/ticket/3988#preview">#3988</a> and here’s a <a href="http://stackoverflow.com/questions/477463/jquery-is-waiting-for-images-to-load-before-executing-document-ready">Stack Overflow question</a> in which John Resig talks about the issue in some detail.</p>