September 17, 2012, 10:59 am
The Telerik ChartView control is nice, but if you cannot create your XAML ahead of time (or in other words, you don’t know how many LineSeries you are going to have on your chart), then you are in uncharted territory. Especially if you are not super solid in WPF and data binding as I am.
Using their example code, I was able to get the track ball info to show the date and value of the data points (basically the X and Y values of the data point), but instead I wanted to show a label for that LineSeries along with the Y value. Initially I tried to use a DataTemplate in the Resources of my user control, but I could not get the binding to work the way I wanted to.
Finally, to solve this issue, I had to resort to build the XAML in my code and set the TrackBallInfoTemplate. Here is what it looks like:
// the class holding the data for the chart...
public class SalesInfo
{
public string Employee { get; set; }
public DateTime Time { get; set; }
public int Value { get; set; }
}
// then, further on down the code...
Color[] colorArray = { Colors.Red, Colors.Green, Colors.Blue, Colors.Yellow };
// and...
data = new RadObservableCollection(data.OrderBy(x => x.Time));
Color dataColor = colorArray[loopCounter % 4];
LineSeries line = new LineSeries();
line.Stroke = new SolidColorBrush(dataColor);
line.StrokeThickness = 2;
line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Time" };
line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
line.ItemsSource = data;
StringBuilder templateString = new StringBuilder();
templateString.Append("<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>");
templateString.Append("<StackPanel Orientation='Horizontal'>");
templateString.Append("<TextBlock Text='" + u + "' />"); // u refers to the name of this line series (Employee)
templateString.Append("<TextBlock Text=': ' />");
templateString.Append("<TextBlock Text='{Binding DataPoint.Value}' />");
templateString.Append("</StackPanel>");
templateString.Append("</DataTemplate>");
var xml = XmlReader.Create(new StringReader(templateString.ToString()));
var tbiTemplate = (DataTemplate)XamlReader.Load(xml) as DataTemplate;
line.TrackBallInfoTemplate = tbiTemplate;
myTelerikChartView.Series.Add(line); |
// the class holding the data for the chart...
public class SalesInfo
{
public string Employee { get; set; }
public DateTime Time { get; set; }
public int Value { get; set; }
}
// then, further on down the code...
Color[] colorArray = { Colors.Red, Colors.Green, Colors.Blue, Colors.Yellow };
// and...
data = new RadObservableCollection(data.OrderBy(x => x.Time));
Color dataColor = colorArray[loopCounter % 4];
LineSeries line = new LineSeries();
line.Stroke = new SolidColorBrush(dataColor);
line.StrokeThickness = 2;
line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Time" };
line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
line.ItemsSource = data;
StringBuilder templateString = new StringBuilder();
templateString.Append("<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>");
templateString.Append("<StackPanel Orientation='Horizontal'>");
templateString.Append("<TextBlock Text='" + u + "' />"); // u refers to the name of this line series (Employee)
templateString.Append("<TextBlock Text=': ' />");
templateString.Append("<TextBlock Text='{Binding DataPoint.Value}' />");
templateString.Append("</StackPanel>");
templateString.Append("</DataTemplate>");
var xml = XmlReader.Create(new StringReader(templateString.ToString()));
var tbiTemplate = (DataTemplate)XamlReader.Load(xml) as DataTemplate;
line.TrackBallInfoTemplate = tbiTemplate;
myTelerikChartView.Series.Add(line);
And so now, here is what my chart view looks like with the customized track ball info:

BTW, Happy Birthday to Ty Tabor.
EDIT: I would like to take a moment to say thanks to Yavor from Telerik, he responded to my posting on the Telerik forums and pointed out that the DataPoint object has a DataItem object child that is the object that created the DataPoint. As a result, in my XAML Resources, I can bind to DataPoint.DataItem.Employee, and it works as expected. Here is that link:
Creating LineSeries programmatically with custom TrackBallInfoTemplate
September 4, 2012, 12:03 pm
So I was having an issue with my NSLocalizedString entries. At seemingly random intervals, the app that I built and deployed to either the simulator or the iPad would display the key that I pass into NSLocalizedString instead of the value from my Localizable.strings file. Which is very annoying.
As it turns out, the app was getting confused because I had 2 Localizable.strings files in my project. So if this is happening to you, make sure that you are looking at the file list in your workspace, and start typing Localizable in the search field at the bottom of the list. If you see more than two Localizable.strings files, consolidate them into one and then delete the extra ones.
Also, I have been having a devil of a time trying to get MobileVLC built and running. If you can help, please take a look at my posting on Stack Overflow on the latest issue:
iOS SDK 5.1 linker error for non_lazy_ptr in Xcode 4.4.1
I have also posted to the VideoLAN forum about this issue, again with no luck:
iOS SDK 5.1 linker error for non_lazy_ptr in Xcode 4.4.1
BTW, happy birthday (posthumously) to Danny Gatton, a supremely talented guitar player who left us too soon.
August 18, 2012, 9:34 am
OK, so I have been playing this time waster of a game on my iPad called Pocket Planes. Needless to say, it is kind of an interesting diversion at times.
It has a pretty large world that it encompasses, so I would guess that eventually, you would have something interesting pop up. Here are a couple of ones that I thought were amusing.

I would guess that either the package bound for New York is either really small, or that there are a real lot of items in the package.

Um… Some jokes just write themselves.
BTW, Happy Birthday to Mike “Spanky” LaValliere, who I met at the 2012 Pirates Fantasy Camp.
August 13, 2012, 11:55 am
Last Friday and Saturday, I attended the CocoaConf conference held here in Columbus, Ohio. This conference, as you can tell from the name, is geared toward iOS and Mac OS X development. The conference was well run, thanks to Dave Klein and his family for that. The sessions I found the most interesting and informative were the sessions by UIAutomation and gesture recognizer presentations by Jonathan Penn.
For you Routzy fans out there, there was a review posted about the app, please check it out:
Routzy: The All-In-One CRM iPad App for Sales Professionals
BTW, Happy Birthday (posthumously of course) to Alfred Hitchcock, one of my all time favorite directors. And a sad note of passing, Les Paul entered the great jazz club in the sky this date 3 years ago.
July 25, 2012, 9:20 am
Kevin Munc gave a presentation last night on doing continuous integration using Jenkins for developing iOS apps. It seemed somewhat complicated to set up, but I did like some of the things that he showed. Hopefully I will get a few free seconds here at my job to try and implement some of the things that Kevin showed.
Also, for those few of you who use Xnews for reading your Usenet newsgroups, it was acting up for me by not remembering that I only wanted to see unread articles when going into a newsgroup, I would have to hit the U key after the newsgroup loaded to hide all the read headers. This is far too much work for me. The way I found to get around this was to exit the program and spelunk into the folder on your computer where Xnews lives, and look for a folder called “data”. Inside this folder, you may see a folder or file for the group that you are having trouble with. When I saw this, I just deleted the file, started the application back up, and all was right with the world.
BTW, Happy Birthday to Doug Drabek, the former pitcher for the Pirates (and other teams) that I met briefly at last years Pirates Fantasy Camp.
July 16, 2012, 9:52 am
I just stumbled on this by accident this morning. After my Google I/O provided Nexus 7 had an OTA update, I went into the About tablet section of the Settings app, and somehow I triple tapped on the Android version 4.1.1 table cell, and I got this:

I have always been a fan of Easter eggs ever since I found out how to find the secret room in Atari 2600 Adventure. BTW, Happy Birthday to Jerry Doyle, who was great as the security chief in Babylon 5.
ADDENDUM: Two things to add, one good and one bad. The good thing is that my buddy John noticed that if you draw around the outer edge of the big bean, you get a screen with a lot of littler beans, which can be flung about. No collisions though. And the bad, it is sad to note the passing of Jon Lord, a giant in world of music.
July 12, 2012, 1:38 pm
So I am looking around for some ideas on making this WPF based application for Windows that I am working on look slightly less sucky. And I see some nifty themes on this web page:
WPF Themes
And I am thinking that would be pretty cool to just swap in one line in the App.xaml file, and my whole app would look different.
Cool in theory, but some implementation details are a bit fuzzy.
Here is what I did to get it working with VS 2010 Ultimate:
- Install the WPF Toolkit by clicking on the big purple “download” button on the above web site
- Download the themes xaml files by going to this web site: WP Futures (scroll down to WP Themes and click the link to download the zip file)
- Unzip the downloaded file and add the needed xaml files to your WPF project
- Add a reference to WPF Toolkit in your application’s References folder
- Add a ResourceDictionary line to the Application.Resources section of your App.xaml file to make it look like the one shown on the WPF Themes page above
Keep in mind that if you put your xaml theme files in a folder off the root of your project, you will need to adjust the Source property of the ResourceDictionary. For example, I put the xaml theme files in a Themes folder off the root of the project, so the Source for me looks like this:
<ResourceDictionary Source="/Themes/ExpressionDark.xaml" /> |
<ResourceDictionary Source="/Themes/ExpressionDark.xaml" />
BTW, Happy Birthday to John Petrucci, who is quite clearly not a native of this planet.
July 7, 2012, 8:59 pm
Sorry about the delay between postings, but unfortunately I learned of the passing of my father while I was at the day 2 keynote address at Google I/O. So I think that days 2 and 3 the conference were good, but I was a bit distracted.

The best that I can say of my dad was that he sacrificed much, and asked for little in return. That is the mark of a great parent.
12/1/1941 – 6/28/2012
Good bye Padre. We will remember you forever.
June 28, 2012, 10:34 am
Well day 1 of Google I/O is in the rear view mirror. While the event logistics were not the best, the content was decent, if a bit geared toward the intermediate to advanced Android developer. The line to get my Android developer devices was far too long, so I decided to wait until the next day.
After the conference was done for the day, I decided to take public transit and head over to Amoeba Music in Haight-Ashbury, and I was a bit diasppointed. I had not been there in many years, and I guess I remember it having more selection before. But I could be wrong.
BTW, happy Perfect Number Day to everyone out there. Yeah, that is not an actual holiday, I just made it up.
June 20, 2012, 10:13 am
If you are ever planning to have someone from a country other than the U.S. use your iOS application, then I would go through right now and check for all the floatValue and doubleValue methods of NSString, and get rid of them if the NSString is coming from data that the user can enter. Needless to say, those users in Europe who use a comma for the decimal separator and a period for the thousands separator will notice some hilarities when using your app.
I put together a quick method in my NSString categories code (notice that it uses self as the source string) that I am using to avoid this very issue. Here is what it looks like:
- (double)localeSafeDecimalValue
{
NSNumberFormatter *decimalStyle = [[NSNumberFormatter alloc] init];
[decimalStyle setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber *n = [decimalStyle numberFromString:self];
[decimalStyle release];
return [n doubleValue];
} |
- (double)localeSafeDecimalValue
{
NSNumberFormatter *decimalStyle = [[NSNumberFormatter alloc] init];
[decimalStyle setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber *n = [decimalStyle numberFromString:self];
[decimalStyle release];
return [n doubleValue];
}
This will work as long as the user is entering numbers in the format that their International Settings are set to on their iOS device.
BTW, happy birthday to Michael Anthony, bass player and backup singer of Van Halen and Chickenfoot fame.