The type initializer for +’System.Windows.PresentationSource’ threw an exception.

I had an issue with a 3rd party control. I couldn’t blame them too much since the issue only happened in the WPF control hosted in a MFC C++ application. brutal for sure. Why host WPF in C++? That is a question for another time, but let’s just say its an app written in the […]

How to display a different value in a WPF combobox based on selection

I couldn’t figure out a great way to title this post. Anyway, the issue I had was having a (none) value in the combobox but when it is selected show a blank combo. Those were the requirements and I wanted to do an easy solution without having to write a converter. Here is the solution […]

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   using System; using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; namespace Seekford […]

How to center or right align the Header in the WPF RadGridView by Telerik?

Telerik is not the best at providing documentation on how to do things, so I figured I would write some of the more mundane tasks that took me a few minutes thought. Here, I needed to center my headers. It is easy but only if you know all the magic words. If you don’t, it […]

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 […]

Speed up WPF XAML Editor in Visual Studio 2012

Tired of the stupid XAML editor being so slow. Mine freezes, locks up and is otherwise unruly. I didn’t seem to have a choice if I wanted intellisense in Visual Studio before 2012. Well, apparently they fixed the source code editor in 2012 to have working intellisense so there is now a viable option for […]

How to add a picture to a worksheet in Word and Excel using VSTO with c# and autosize

Here is a really simple example of adding a picture without really needing to know the dimensions of the image. Excel uses points which is pretty annoying, since pics are in pixels….duh… I put in the sizes for my pics, but you could use any number since we repair it with the scale calls. Anyway, […]