Windows Phone 7 Chart Control Data-binding with xml (MVVM)

Sunday, December 18, 2011

Windows Phone 7 Provide you great Support of Data Visualization with Charts and Vector graphic. You can also bind chart with xml data by using mvvm pattern.

To Create Chart Control with XML.

Open Visual Studio 2010 then create new Silverlight windows Phone Project

Add XML file and define some schema

Add three Folders in Solution "Model", "View" , "ViewModel"

Add Class in Model name ResultView.cs and map your xml scheme with properties.

Add Class in ViewModel and Named ResultViewModel.cs in this class you load data from xml

Open App.xaml and define or copy from sample code in you Template for PhoneChart Portrait and Landscape orientation in ResourceDictionary.

Add one UserControl in your View Folder and named ResultView.xaml.

Open MainPage.xaml add View in it :)

Open MainPage.xaml and Override the OnOrientationChanged event handler and change template on On Orientation.

F5 and Enjoy :)

Download Source Code Here

By Usama Wahab Khan
for More Question and help email me :)
thanks ali sultan for send two screen short :)

share this post
Share to Facebook Share to Twitter Share to Google+ Share to Stumble Upon Share to Evernote Share to Blogger Share to Email Share to Yahoo Messenger More...