Getting around lack of ItemBound on a ListView in WPF

I recently was working on a project where I needed to bind some data to a ListView in WPF. This is pretty easy, and using my Dataset, took really no work at all. But when trying to figure out some simple ways to update my ListView on each item being bound (where you would usually use a OnItemBound event in other controls), this (and nothing like it) really exists in a WPF ListView control.

There were a few workarounds for this. I could update how my DataSet was being generated, and just bind those ‘special’ controls in the ListView in these new fields, or use a List that I found in this post. While updating the DataSet would be nice, using a List may let me knock out two birds with one stone (due to some other requirements).

So I set forth mapping the DataSet to my List. This is as simple as doing something like…

List theItems = new List();

foreach(DataRow dr in ds.Tables[0].Rows)
MyItem tmpItem = new MyItem();
tmpItem.Value1 = dr["value1"].tostring();
tmpItem.Value2 = dr["value2"].tostring();


I can then map this collection to my ListView, rather than the DataSource itself. All I have to do in my XAML then is just update my ‘DisplayMemberBinding=”{Binding value1}‘ to point to the new item in the list ‘DisplayMemberBinding=”{Binding Value1}‘. If one of those is a bool, and I have that mapped to a Checkbox or RadioButton, its a little easier for me to manage (being so used to having the option to do an OnItemBound method to handle some of the same stuff). My bigger concern of needing this was to convert values on the fly. For example, if something is returning any value (int or null), id like to map that to True or False instead. This is a really simple example, but just an idea of something you could do if you needed this extra functionality!


Listening To: ’15 Step’ by Radiohead

Gmail Labs

Last night, Google announced and launched a new feature in Gmail called ‘Gmail Labs’. This feature allows Google employees to write mini-apps for Gmail for the users. From what I read, its any Google employee, not just Gmail developers. Google has this really cool ‘20% rule’, where 20% of your work time should be dedicated to doing something for the company other than your ‘regular’ job. So they opened up the Gmail code to all employees, and want them to make stuff!

Right now there are about 13 tools to choose from. Everything from pictures in chat, mouse gestures, to being able to play the old school game Snake! There is even one that will block your screen for 15 minutes to take a break!

You can get to the Lab by clicking on Settings, and then on Lab. They started rolling it out around 9PM Eastern last night, but I didn’t get it in my account until this morning. Im not really sure if I am going to use any of these just yet, but the possibilities are endless of course. Supposedly as new features are placed in the Lab, as the user base grows and code is double-and-triple checked, these features will eventually make it into the normal Gmail code base. 

Now I just wish one of the people there would realize a to-do feature in gmail would be PRICELESS!

NewsGator products now free, why should I stick to Google Reader?

Note – I started this post last week. Since then, due to some other circumstances, I switched back to Google Reader. This posts outlines my experience over the last week, and why I went back!

Last week, the teams at NewsGator announced that instead of charging a few bucks for their news readers, everything was now freely available. Some of these readers, including NetNewsWire for the Mac and FeedDemon for the PC are really the top readers available. Other than my desire to always find free and/or open source ways of doing things on the computer, I would have easily paid the money to use either one of these applications.

I posted over a year ago my about my move to Google Reader. It was a move I was very happy with, and used MULTIPLE times a day, every day, over the last year. One of the main reasons that I went to an online reader was because I used multiple machines. I didn’t want to have to read posts in one place, and then re-read (or mark as read) the ones I had already seen. I even wanted to work on the source code of my preferred feed reader at the time (it was an open source C# reader) to allow it to read the sync’d information from NewsGator.

Right after I heard all the products were now free, I immediately downloaded NetNewsWire on the Mac and FeedDemon on the PC. Google Reader (like most all other readers) let me export my OLPC file to import into the other reader. I set up a News Gator account, and I was in RSS-syncing heaven.

I love Google products, and really, I would have never thought about switching. The only thing that made me even want to try was because of the speed. Google cache’s feeds, depending on their popularity. So if you have custom feeds, like your Facebook friends status updates, that only gets updated every few hours. Other more popular feeds, like Digg, get updated a few times every hour. For the most part this is great, but its really annoying when I do use particular websites, like Facebook, and the status updates are even up to 5 hours behind!

Ive enjoyed using NetNewsWire. It’s one of the perfect Mac programs, everything works the way its supposed to. The interface is really clean, the UI is very easy to use, and it has a feature that I didn’t even know was important to me – something called ‘River of News’. When I read my news, I prefer just to have a long list of items, rather than reading through each feed or each category individually. I quickly browse through my 200+ feeds, and open up those that strike my interest. If im on my cellphone, I would just start particular feeds and read them at home.

On the other hand, I really didnt like FeedDemon. It was slow. First of it all, it doesnt have this River of News flow, and that really slows down my reading. It was also very sluggish on my pretty speedy laptop, and was confusing to use at times. There were plenty of times I just wanted to give up this whole trial because of this application.

I never got to try out the Windows Mobile feed reader from News Gator. This is mainly due to me being really busy over the last week, but also because Debs and I switched cell phone providers last night. Therefore I can’t really review the program, which is ashame, because I did have high hopes for it. Now that I have a blackberry (more on that later), I notice they have a blackberry client. Looking at the screenshots, I dont think Im going to be very happy to use it, it looks closer to the Windows client than the Mac. Combined with my dislike for the Windows client, I’m not going to even waste my time installing this one on my blackberry unless I hear rave reviews on it.

Overall I was happy with this switch for a while. I have always liked NetNewsWire. I used NetNewsWire Lite at my old job to track most feeds as well as custom internal feeds we used at work. If there was a program like it that would sync on the PC, I would never touch Google Reader again. But with my complete dislike for the Windows client (slowness, hard to use, and it just took me too long to read my feeds), Im going to have to leave this mix of clients.

Time to go mark my 2000+ ‘unread items’ as read, and get back to how things were! I noticed I have a few more friends in my Google Talk list now sharing items, as well as hearing that Google Reader got some updates while I was gone!

For those considering the switch – either way – Lifehacker had a great post before I started my experiment about the pro’s and con’s of both! I suggest that you check it out!

Listening To: ‘When Your Gone’ by The Cranberries

.NET Framework Source Code Available!

Scott Guthrie, one of the interesting and bleeding edge Microsoft developer blogs announced today that the .NET Framework Library Source code was now available. This is a big deal, and something I really look forward to taking a look into.

While one of the main reasons for releasing this code was to help developers debug better, areas outside of this are already paying attention. Case in point, Mono. Mono is the software that allows developers to develop .NET apps for platforms like the Mac, Linux, Solaris, and other platforms. I have been toying around with Mono for a years now, just fooling around on the Mac and Linux to see what I could do. Over that time, the project has not only gained more and more popularity, it also has gained substantial backing, its currently sponsored by Novell.

Discussed around the internet a few months ago when Scott announced the plan to release this source code, people immediately talked the possibilities of this and Mono working together. But of course, this could never work. This new code is not actually open source, and neither is the license its released under! Right after Scott announced this, Mono posted on their site their stance on using any of this, which you can read here. Basically, none of this code could/will be used. What I am not sure about is using any Microsoft intellectual property/development methods/etc. to influence parts of the Mono Project. I would assume no, since in most cases, closed source (and even some open source) licenses protect this as well.

I personally would love to start working with this. They currently have released the code to some of the more common parts of the library, some stuff that I use every day. Its mostly for debuging code, but I also think it would be a GREAT learning tool. Pretty much all of my programing knowledge is self-taught, with some help from friends, teachers, and the internet along the way. But in all of those cases, other than from friends/other projects, you never really see ‘real code’. Everything you read in school is theory, and stuff you see online only explains a key point or two, not all 10 points you may be trying to cover together. Being able to see the actual code of the Libraries that we program against every day not only shows you methodology, but may even the way developers at Microsoft designed these tools.

Unfortunately, our team at work wont be going to VS2008 any time soon (though it would eliminate the need for me to use VS2003 and 2005 together). I have it installed on my home machine, but just have not had the chance to use it just yet! There’s a lot of things brewing around here, so time will tell!

Listening To: ‘The Sounds of Settling’ by Death Cab for Cutie

(Dont) Give Up on Vista

After a lot of thought (and in the end, a lot of work), I finally gave up on Vista. While I wish it was because of this ad (and we all had new Macs), its because I was just tired of all the crap. Vista is awesome to use, and I would actually be using it at home if I had a PC, but for work, I really just find it to be more of a hassle/burden/general P.I.T.A than using the latest and greatest technology.

Our development team has 3 pretty new Dell Precision laptops, all running Core 2 Duos, 2 GB of RAM, etc. They came with Vista Business installed, which is one of the more ‘powerful’ Vista flavors, mainly designed for great compatibility, higher security, and more corporate uses. Since in my previous job I was a Mac guy, it was really nice to start off with the Mac-like Vista.

Well, when setting up one of the laptops for the new Project Manager, we decided to try out XP rather than Vista. The results were amazing. The machine was blazing fast. The machine was much more stable, much more responsive, and everything just worked better. We installed all the other common software, and we have not had a problem since.

The only thing holding us back on wiping our machines then was that we were in the middle of a huge project that needed to get out the door, and we couldn’t loose any time or data. Now that things have cooled down, it was time to get to work.

So, with my massive amount of time i have taken off this month, I dedicated some time to finding all the software I needed, backing up everything I had (story about this process to come later), and starting a fresh install. Now, with some help from Chris (he did the original setups on these machines, so I did not know where half the software was), I now have a fully working machine again, thats running faster than ever. That, and I dont have to wait 30 minutes for VMWare Server to boot my XP Virtual Machine so I can program in Visual Studio 2003.

But of course, after yet another week off, everything didn’t go without a hitch – I walked into a dead T1 this morning. It had been knocked out sometime late last night, and after numerous resets, nothing worked. Luckily after 2 hours, I receive an email from someone outside. It actually took a few moments to register – most of the time I just see emails come through and ignore until I get a chance. Well, of course I did the same for this one, and then remembered – ‘oh wait…wow….our internet is back’.

Now emails are flowing, music is playing, and im really back into the groove at work. Next week will be my first ‘almost’ full week in a month…and im really excited to start hammering away at some of the big projects for 2008.

Listening To: ‘Reason is Treason’ by Kasabian

The new is finally live!

This is one day that I have been waiting for a few months now!

After almost a year of planning, design, and development we were finally able to fully deploy the new site! Its been a crazy few past weeks trying to fix a bunch of things, update stuff, but in the end, I really think it has paid off! Its a long story on why we had to push it back a bit, but its live, and I am much happier now!

This has to be the largest project I have worked on to date!

There are so many more ideas and projects in the pipeline (coming to and our other products) that I finally have more time to devote to, so its not all over yet, but a huge weight has been lifted off my shoulders.

Listening To: ‘Spies’ by Coldplay

Ruby on Rails – not all its cracked up to be…

Recently at work I have found myself having to debug a lot of Ruby code for some sites that we recently put live. I also had to do some further deployment on the sites, since things like email were not actually working correctly when put into production. But when clicking around through the code, deploying new builds of the site, and testing my changes, the only thing going through my head was ‘why does this Ruby stuff have such a following’.

Im not writing this post to bash anyone, the community, or the language. Im sure it has its uses, and I have to say that I really like the community around the language (which I will talk more about later).

Its almost like some type of ‘cult’ around it. While yes, many people can say that I could be a member of some of these ‘cults’ (ie the Mac people)…im definitely not a ‘fanboy‘ by any means (hell, I even think most Mac people are weird…espc the ones who act like they saw the second coming because they ‘switched’). In the case of ruby, you have a huge cult following that has produced some REALLY cool products. These products then get a ton of publicity, and it all just rolls up together (oh that site was made with Ruby…then it has to be good!).

There was recently a post that came across Digg about ‘The 10 reasons you should be using Ruby on Rails‘. Well, following a long with a lot of the comments, ill back every one of these 10 reasons with 10 truths:

  1. Most modern languages give you these ‘treats’ already. I use try/catch and namespaces every day! Pretty much any modern iteration of any language supports all 5 of these topics.
  2. What little things? This topic pretty much points to the fact that Ruby reads almost as easy as English. Wow, AppleScript has been doing this for years. But when it comes down to it, I am more concerned about what the code actually means instead of it looking grammatically correct!
  3. Yeah…and you will never be able to put more than one command per line of code. Who cares? Its easier for me to understand that a semicolon is the end of a line of code, rather than figuring out why a method is ending in a exclamation point or question mark (from the posters reason #2)
  4. In most object oriented languages, everything is an object! Strings, Integers, you name it.
  5. This just doesnt make sense. Its just being lazy.
  6. Again – anyone can do this. And honestly its a lot easier to set up a webapp in IIS than it is to configure mongrel and update it.
  7. Also doesn’t make sense.
  8. While its not a standard everywhere, XML itself is standardized, and used just about everywhere. No one cares that you make up your own markup language that reads easier.
  9. ‘foreach’ is one of my favorite commands…and a lot easier to use than what the writer is describing here.
  10. This is slow. And the fact that ‘Ruby has features no other language can offer’, I really hope the user wasnt using the previous 9 topics to prove that.

All of this is up to preference. I do love how the writer ends with ‘…the next time your frustrated because your code looks ugly…’. I can’t stand reading scripting languages (always seem like a hack job), so its more of a pain to me than reading standard C# code. In reality, its the developer and their processes that build the final product more than the platform used to get there.

I just can’t understand how people get so excited about a plain-old scripting language that has been around for quite a while. This is where my community comment above comes in. Any group, idea, method that has a gathering can mold it to many different objects. With Rails becoming so popular, many online networks have formed creating a close, very active community.

Just wait for all those Mac fanboys…so excited that Mac OS 10.5 ‘Leopard’ (if you haven’t heard, its coming out next week) has ruby on rails built in. Alas, if they paid any attention, they would have noticed ruby ( and partially rails ) has been there for quite a while :).

Listening To: ‘Gone Gone Gone (Done Moved On)’ by Robert Plant and Allison Krauss