I've been encoding a lot of my CDs in iTunes (10.1.2) lately. It generally does a great job of encoding to Apple Lossless and grabbing the appropriate track data and cover art from the internet I've have come across an annoying problem. Occasionally, despite ALL of the tags being the same, and numerous combinations of "Compilation, Sort Album, etc..." being set, iTunes still insists on listing a compilation album as individual tracks like this:
A google search of the problem shows that I'm not alone. There seems to be as many solutions as there are people posting so in case it's of any use, here's what has worked for me every time.
It has been a while, but not completely quiet on the DoshTracker front. Although last year my Project 365 took up most of my free time, I have been slowly working on another UI design using a new Javascript framework (jQuery) and this time it's really coming together.
We have:
Check out the new logo and design on www.doshtracker.co.uk and please sign up for our mailing list so we can keep in touch.
Invites to the closed beta test will be going out soon to the mailing list and former users of the old site.
Here's an interesting one that had me stumped for a few hours.
Following on from my previous post, where I explained how to create a ControlTemplate to style a TextBox in WPF, I've got an object, TextEntryBox, which dervies from a TextBox (it provides some custom event handlers when text is entered, but to all intents and purposes, it's a regular TextBox).
I wanted to style my TextEntryBox, this time including a button within my ControlTemplate (this will eventually toggle an on-screen keyboard pop-up, but that's another blog post!). I came up with this:
All's well and good, until I want to try and handle the Click event for that button within my TextEntryBox class. Even Matthew MacDonald's "Pro WPF in C# 2008" which has proved a lifesaver for all things WPF since I've been working with this technology only had the following words of wisdom;
"You can't attach event handlers in the control template. Instead, you'll need to give your elements recognizable names and attach event handlers to them programmatically in the control constructor"
But whatever I tried I couldn't access the event in my constructor, until I remembered the seperation between the visual and logical trees in WPF.
The template is applied at runtime, and so elements contained within it it are part of the visual tree. My class, and therefore my class' constructor is executed within the logical tree, so I needed to attach my event handler after the template had been applied. You can do this by overriding OnApplyTemplate in your class, obtain the template that's being applied, and then you have access to the named button's events, like this:
public override void OnApplyTemplate() { DependencyObject d = GetTemplateChild("PART_KeyboardPopupButton"); if (d != null) { (d as Button).Click += new RoutedEventHandler(KeyboardPopupButton_Click); }