Click here to Skip to main content
15,893,381 members
Articles / Desktop Programming / XAML

Styling the Chart Control in the Silverlight 4 Toolkit

Rate me:
Please Sign up or sign in to vote.
4.85/5 (13 votes)
22 Aug 2011CPOL3 min read 64.1K   2.5K   15  
Styling the chart control in the Silverlight Toolkit to create a new look and feel.
  • ChartTesting.zip
    • ChartTesting
      • ChartTesting.sln
      • ChartTesting
        • App.xaml
        • App.xaml.cs
        • Bin
          • Debug
            • AppManifest.xaml
            • ar
              • System.Windows.Controls.resources.dll
            • bg
              • System.Windows.Controls.resources.dll
            • ca
              • System.Windows.Controls.resources.dll
            • ChartTesting.dll
            • ChartTesting.xap
            • cs
              • System.Windows.Controls.resources.dll
            • da
              • System.Windows.Controls.resources.dll
            • de
              • System.Windows.Controls.resources.dll
            • el
              • System.Windows.Controls.resources.dll
            • es
              • System.Windows.Controls.resources.dll
            • et
              • System.Windows.Controls.resources.dll
            • eu
              • System.Windows.Controls.resources.dll
            • fi
              • System.Windows.Controls.resources.dll
            • fr
              • System.Windows.Controls.resources.dll
            • he
              • System.Windows.Controls.resources.dll
            • hr
              • System.Windows.Controls.resources.dll
            • hu
              • System.Windows.Controls.resources.dll
            • id
              • System.Windows.Controls.resources.dll
            • it
              • System.Windows.Controls.resources.dll
            • ja
              • System.Windows.Controls.resources.dll
            • ko
              • System.Windows.Controls.resources.dll
            • lt
              • System.Windows.Controls.resources.dll
            • lv
              • System.Windows.Controls.resources.dll
            • ms
              • System.Windows.Controls.resources.dll
            • nl
              • System.Windows.Controls.resources.dll
            • no
              • System.Windows.Controls.resources.dll
            • pl
              • System.Windows.Controls.resources.dll
            • pt
              • System.Windows.Controls.resources.dll
            • pt-BR
              • System.Windows.Controls.resources.dll
            • ro
              • System.Windows.Controls.resources.dll
            • ru
              • System.Windows.Controls.resources.dll
            • sk
              • System.Windows.Controls.resources.dll
            • sl
              • System.Windows.Controls.resources.dll
            • sr-Cyrl-CS
              • System.Windows.Controls.resources.dll
            • sr-Latn-CS
              • System.Windows.Controls.resources.dll
            • sv
              • System.Windows.Controls.resources.dll
            • System.Windows.Controls.DataVisualization.Toolkit.dll
            • System.Windows.Controls.DataVisualization.Toolkit.xml
            • System.Windows.Controls.dll
            • System.Windows.Controls.Toolkit.dll
            • System.Windows.Controls.Toolkit.Internals.dll
            • System.Windows.Controls.Toolkit.xml
            • System.Windows.Controls.xml
            • TestPage.html
            • th
              • System.Windows.Controls.resources.dll
            • tr
              • System.Windows.Controls.resources.dll
            • uk
              • System.Windows.Controls.resources.dll
            • vi
              • System.Windows.Controls.resources.dll
            • zh-Hans
              • System.Windows.Controls.resources.dll
            • zh-Hant
              • System.Windows.Controls.resources.dll
        • ChartTesting.csproj
        • MainPage.xaml
        • MainPage.xaml.cs
        • obj
          • Debug
            • TempPE
        • Properties
      • ChartTestingSite
      • PrecompiledWeb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<!-- saved from url=(0014)about:internet -->
<head>
	<title>ChartTesting</title>

	<style type="text/css">
	html {
	    height: 100%;
	    overflow: auto;
	}
	body {
	    height: 100%;
	    padding: 0;
	    margin: 0;
	}
	#silverlightControlHost {
	    height: 100%;
	}
	</style>
	<script type="text/javascript" src="Silverlight.js"></script>
	<script type="text/javascript">
        function onSilverlightError(sender, args) {
        
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            } 
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
            
            if (errorType == "ImageError" || errorType == "MediaError")
                return;
            
            var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError")
            {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError")
            {           
                if (args.lineNumber != 0)
                {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
    </script>
</head>

<body>
	<!-- Runtime errors from Silverlight will be displayed here.
	This will contain debugging information and should be removed or hidden when debugging is completed -->
	<div id='errorLocation' style="font-size: small;color: Gray;"></div>

	<div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
			<param name="source" value="ClientBin/ChartTesting.xap"/>
			<param name="onerror" value="onSilverlightError" />
			<param name="background" value="white" />
			<param name="minRuntimeVersion" value="4.0.50826.0" />
			<param name="autoUpgrade" value="true" />
			<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none;">
				<img src="http://go.microsoft.com/fwlink/?LinkID=161376" alt="Get Microsoft Silverlight" style="border-style: none"/>
			</a>
		</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect DevCrux
Nigeria Nigeria
Software Designer * Developer | Hi-Tech | Geek | Graphics | HTML | Silverlight | WPF | WCF | WinForms | Expression Blend * Design * Web | C# 2.0 * 3.0 * 4.0....

http://blog.devcrux.com
http://www.devcrux.com
http://www.facebook.com/Devcrux
http://www.facebook.com/sunnymexy

Comments and Discussions