FIX: TabControl in WPF Shows wrong tab if Active Tab is Invisible

You want to dynamically show or hide tabs in WPF. Say, some only show up if a certain option is set. Well, it shows anyway if its the first tab. Stupid. Here is an attached property to fix that. Based on code from http://www.codeproject.com/Articles/349140/WPF-TabControl-focus-behavior-with-invisible-tabs   using System; using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; namespace Seekford […]

How to run a batch file with administrator priveleges with automatic elevation

Do you have build scripts that require you run commands elevated. Do you forget to click run as admin then you get errors halfway through a 20 minute build? Well, I did all the damn time. I found this script change and it works awesome so I figured I would share with the class. if […]

WPF Validation Errors not showing on initial load of control or window

I was setting validation errors on the initial load of my view model, and to my annoyance the window would show up like everything was great. The validation code was definitely running, the HasErrors was true, the dictionaries were filled with the errors but the form was like, “What errors?” ┬áThis irritated me. Well, WPF […]

How to access legacy forms checkboxes and ActiveX checkboxes in Word using C#!

Apparently, doing this simple task is not well documented. None of my searches lead to anything useful, so here is what I wrote for how to handle the search for all checkboxes in a word document then set them all to false. Obviously, you can use this to get values, launch rockets, whatever it is […]

How to unshelve a shelveset from one branch into another branch!

I was doing a lot of work in our Main branch for a new version of our software. Lo and behold, this iteration requires we work on both the future and current version at the same time. Only a few of us are on the new version, therefore the Main branch code branched into a […]

How to programmatically change your Windows domain password using C# (.NET)

Ever wanted to write a program that would change your password for you? Why on earth would you want this? Well, imagine you have a password policy that requires you to change your password every X days. Well, maybe you like your password and think it dumb to have to keep changing it. Maybe you […]

A better Dictionary/Hashtable. One that allows multiple entries per key.

Ever need the speed of a dictionary or hashtable, but also want to store more than one item with the same key? i.e. Maybe you have lists of items that need to be indexed against certain keys. Maybe, Orders keyed by UserId. Well, enter the easy to use MultiDictionary. A class I put together to […]

Continue or Break using Parallel.ForEach

You might be converting your normal foreach loop over to use the Parallel.ForEach syntax to improve performance in a thread safe loop. You also probably have some break and continue statements. Well, it took me a few to figure out how to deal with these. Turns out, it is simple. When you converted your loop […]

C# dynamic variable access slow as mollasses in the winter

I recently ran into an issue where I was using the dynamic keyword to simplify my access to Office apis. I had an object that could be a Word document or an Excel workbook. I needed to set the Saved property. Well, it was easy to use a dynamic and just set it. i.e. dynamic […]

T4 Templates for Entity Framework Break when upgrading to Visual Studio 2012

I upgraded to Visual Studio 2012 and consequently upgraded to version 4.5 of the .NET framework. It turns out, this made our T4 templates very unhappy. See, we use T4 templates for generating our Entity Framework(EF) models. A bunch of very fancy template coding that automagically creates our edmx and other code files from a […]