WPF Unleashed

At work we bought two WPF books a while back in order to make sure we’re up to date on the latest development technologies. It seems to me like development books are really varying in quality and usefulness. I had started to read one of the books, “Applications = Code + Markup”, but it was quite useless in my opinion and I just couldn’t get anything out of it. In fact, it didn’t even discuss XAML until half way in (I skimmed)....

October 27, 2008 · Joshua Marble

DIY WCF Service Client

When writing WCF services, the “by the book” method of consuming a service is to add a Service Reference to your project and let Visual Studio codegen all the necessary classes including a service client. While this is convenient, it can pose some problems in more complex scenarios. As an example, I’ll walk you through an extremely simple situation using WCF Services to get GUIDs. Let’s say that you have a service interface called IGuidService....

October 22, 2008 · Joshua Marble

Visual Studio Search Tip

I accidentally found the handy Visual Studio key combination of Ctrl+I to do an incremental search. It’s a bit odd because you type your search in what appears to be the current cursor location. After you’ve completed typing your search term, press F3 to find the next result. It takes some getting used to, but try it out and you’ll see how it works much easier than trying to understand from what you read....

October 16, 2008 · Joshua Marble

LINQ to SQL Error: The entity is not of the correct type.

I came across an error while working on a LINQ to SQL sample application. The error was “The entity is not of the correct type.” and I could not find much information online about it. The one blog post I found indicated that the problem was related to using a Database View for the data, but I was just accessing the table directly. But there was one part of the article that caught my attention....

October 14, 2008 · Joshua Marble

Use LINQ In .Net 2.0 Projects

I’ve been really enjoying LINQ lately but am unable to use it at work since we are still in the 2.0 framework for now. I came across a Google Code project that aims to implement LINQ functionality in .Net 2.0 using the same namespaces and methods as .Net 3.5 to make the transition seemless. It also provides the necessary classes to implement extension methods in .Net 2.0. Note: Visual Studio 2008 is required in order to use this DLL in ....

October 6, 2008 · Joshua Marble

Extension Methods in .Net 2.0

I know I’m late with the news here, but I sure never heard of this until now. Did you know you can do extension methods in .Net 2.0 with a minor hack? I think Visual Studio 2008 might be required. All you have to do, as I learned from jaredpar’s blog, is create your own class called “ExtensionAttribute” in the correct namespace. After that, you have extension methods. That is crazy!...

October 2, 2008 · Joshua Marble

Binding Multiple Types To A DataGridView

I’ve been having a problem lately with DataGridView binding. I have an interface (IAllergen) which is implemented by three different classes (Drug, DrugIngredient, and AllergenGroup). I want to bind a BindingList to a DataGridView that has a column for one of the properties of IAllergen. My problem with this binding situation is actually two fold. Initially, the implementations of IAllergen were explicit, meaning the interface members only are accessible when explicitly cast as IAllergen....

September 23, 2008 · Joshua Marble

Dropbox Beta Invitation

I just received a beta invitation to the Dropbox file sync, store, and share service. I signed up and installed the software and I have to say it works pretty slick. The software is pretty easy to use. It creates a ‘My Dropbox’ folder under your documents and anything in that folder will be synchronized with their servers. There is a public folder which allows public access to files via obscure URLs, but everything else is private....

September 8, 2008 · Joshua Marble

Another Reason to Love C#

It’s been a while since I’ve had a programming post, so here’s a quick one. Just to show the flexibility of C#, check out the code for the Control.CanSelectCore() method in C#. internal virtual bool CanSelectCore() { if ((this.controlStyle & ControlStyles.Selectable) != ControlStyles.Selectable) { return false; } for (Control control = this; control != null; control = control.parent) { if (!control.Enabled || !control.Visible) { return false; } } return true; } Notice how that FOR loop is used....

August 19, 2008 · Joshua Marble

Blog Authoring Tools

I am a big fan of offline blog entry writing, especially since most web-based editors leave a lot to be desired and can be quite buggy. It didn’t take long with the WordPress editor for me to know I couldn’t actually use it to write anything. I was more hopeful with the BlogEngine.net editor, which is nicer than in WordPress, but it still wasn’t viable for any real authoring. Knowing that I wanted a simple but featured offline editor, I went on a quest to find all the offerings that were available....

August 7, 2008 · Joshua Marble