Delay's Blog is the blog of David Anson, a Microsoft developer who works with the Silverlight, WPF, Windows Phone, and web platforms.
http://dlaa.me/
@DavidAns
In yesterday's post I updated the unsupported public build of WPF Charting. The WPF version of the System.Windows.Controls.DataVisualization.Toolkit.dll assembly in that release is all that's needed to use Charting on WPF, so yesterday's update should to be enough to keep the WPF Charting early-adopters happy...
System.Windows.Controls.DataVisualization.Toolkit.dll
Well, except for the ones that want to be able to tinker with the code and build WPF Charting themselves. So today's post is for those of you who live life on the extreme edge - I'll enable you to build WPF Charting from the Silverlight Charting source code that ships in the March 09 release of the Silverlight Toolkit!
Okay, I've already said that we build WPF Charting from exactly the same sources as Silverlight Charting, so all that's really needed here is a new pair of CSPROJ/SLN files, right? Yes, for the most part, that's true - but there are a couple of other files involved... [There's always a catch, right? :) ]
The process of creating a WPF Charting "development environment" is pretty simple: We'll start with a clean copy of the Silverlight Toolkit source code for Silverlight 3. (Note: We could start from the Silverlight 2 Toolkit code just as easily, but if we did, then the Charting assembly would have the tiny, unnecessary limitation that it assumes Style properties are write-once. That's not the case on Silverlight 3 or WPF, so we'll create the WPF Charting environment from the Silverlight 3 sources.) If you haven't done so already, please download the Silverlight 3 Toolkit March 2009.msi from the Toolkit's CodePlex page and install it - making sure to leave the "Install source code" option enabled. Once the download is complete, extract the included Source code.zip file (you can find it in the Start Menu group for the Silverlight Toolkit) to an empty directory. Then extract the contents of Controls.DataVisualization.Toolkit.WPF.zip to the same directory (overwriting files when prompted).
Silverlight 3 Toolkit March 2009.msi
Source code.zip
Controls.DataVisualization.Toolkit.WPF.zip
Presto: You've got a Controls.DataVisualization.Toolkit.WPF directory containing a SLN you can open in Visual Studio 2008 and begin building immediately!
Controls.DataVisualization.Toolkit.WPF
[Please click here to download Controls.DataVisualization.Toolkit.WPF.zip to start building WPF Charting.]
It's all very straightforward, but just in case I didn't explain the steps clearly, here's an example that goes through the whole process on the command line (you should be able to run the same basic commands on your machine):
C:\T>md WpfCharting C:\T>cd WpfCharting C:\T\WpfCharting>unzip "C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Toolkit\March 2009\Source\Source code.zip" Archive: C:/Program Files/Microsoft SDKs/Silverlight/v3.0/Toolkit/March 2009/Source/Source code.zip ... creating: Controls.DataVisualization.Toolkit/ inflating: Controls.DataVisualization.Toolkit/AggregatedObservableCollection.cs creating: Controls.DataVisualization.Toolkit/Charting/ inflating: Controls.DataVisualization.Toolkit/Charting/AnimationSequence.cs ... C:\T\WpfCharting>unzip ..\Controls.DataVisualization.Toolkit.WPF.zip Archive: ../Controls.DataVisualization.Toolkit.WPF.zip replace Controls.DataVisualization.Toolkit/Charting/Series/DataPointSeries.cs? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: Controls.DataVisualization.Toolkit/Charting/Series/DataPointSeries.cs replace Controls.DataVisualization.Toolkit/DependencyPropertyAnimationHelper.cs? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: Controls.DataVisualization.Toolkit/DependencyPropertyAnimationHelper.cs replace Controls.DataVisualization.Toolkit/StoryboardQueue.cs? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: Controls.DataVisualization.Toolkit/StoryboardQueue.cs creating: Controls.DataVisualization.Toolkit.WPF/ inflating: Controls.DataVisualization.Toolkit.WPF/Controls.DataVisualization.Toolkit.WPF.csproj inflating: Controls.DataVisualization.Toolkit.WPF/Controls.DataVisualization.Toolkit.WPF.sln inflating: Controls.DataVisualization.Toolkit.WPF/IEasingFunction.cs creating: Controls.DataVisualization.Toolkit.WPF/Properties/ inflating: Controls.DataVisualization.Toolkit.WPF/Properties/AssemblyInfoWpf.cs creating: Controls.DataVisualization.Toolkit.WPF/Themes/ inflating: Controls.DataVisualization.Toolkit.WPF/Themes/Generic.xaml creating: WpfToolkit/ inflating: WpfToolkit/WPFToolkit.dll C:\T\WpfCharting>Controls.DataVisualization.Toolkit.WPF\Controls.DataVisualization.Toolkit.WPF.sln
At this point, Visual Studio 2008 is open and you're ready to start WPF Charting development!
Okay, so what about those extra files - why are they necessary if WPF Charting is built from the same sources like I said it was? Well, first off, let's remember that Charting is made up of over 130 files - the extra files here are just a drop in the bucket! But I've got nothing to hide [ :) ], so we'll go through each of them to see why they're necessary:
Controls.DataVisualization.Toolkit.WPF.csproj
Controls.DataVisualization.Toolkit.WPF.sln
IEasingFunction.cs
IEasingFunction
#if
#endif
AssemblyInfoWpf.cs
ThemeInfoAttribute
Generic.xaml
DataPointSeries.cs
DependencyPropertyAnimationHelper.cs
StoryboardQueue.cs
And we're done! Yep, I really was serious when I said that WPF Charting builds from the same exact source code that Silverlight Charting builds from! :)
Thanks again for taking an interest in WPF Charting - I hope the ability to build it yourself makes it even more exciting!