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
I've previously blogged about how to get the Data Visualization assembly from the Silverlight Toolkit/WPF Toolkit working on Windows Phone. It's quite simple with my Data Visualization Development Release 4 and the Windows Phone Developer Tools Beta because it's now as easy as adding a reference to two assemblies and then creating some charts! However, those charts start out with visuals meant for use with Silverlight running in the web browser (white background, etc.), not Silverlight running on Windows Phone (black background, etc.). One of the things I did in a previous post was to customize the appearance of the sample charts so they fit in better with the phone conventions. Because Charting has come up quite a bit with customers lately, I wanted to do a quick follow-up to help make things even easier to use!
Accordingly, I've made the following improvements to the DataVisualizationOnWindowsPhone sample:
DataVisualizationOnWindowsPhone
PhoneDataVisualizationResources.xaml
PhoneChartStyle
PhoneChartPortraitTemplate
PhoneChartLandscapeTemplate
ResourceDictionary
App.xaml
<Application.Resources> <!-- Merge resources from PhoneDataVisualizationResources.xaml (Build Action=Page) --> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionarySource="/DataVisualizationOnWindowsPhone;component/PhoneDataVisualizationResources.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
Chart
MainPage.xaml
<charting:Chart x:Name="myChart" Title="my activity" LegendTitle="legend" Style="{StaticResource PhoneChartStyle}"> <!-- ... --> </charting:Chart>
DataPoint
Legend
Template
Portrait
Landscape
System.Windows.Controls.dll
[Click here to download the updated Windows Phone 7 Data Visualization sample application.]
Important: After downloading the ZIP file above, you should "unblock" it before extracting its contents to avoid warnings from Visual Studio: Security Warning, You should only open projects from a trustworthy source. and The "ValidateXaml" task failed unexpectedly. System.IO.FileLoadException: Could not load file or assembly .... Unblocking is a simple matter of right-clicking on the ZIP file, choosing Properties from the context menu, then clicking the "Unblock" button in the lower, right-hand corner of the resulting dialog and hitting "OK" or "Apply":
Security Warning, You should only open projects from a trustworthy source.
The "ValidateXaml" task failed unexpectedly. System.IO.FileLoadException: Could not load file or assembly ...
Properties