Sets the property of an element from JS (Java Script).
Format:
element.SetPropertyFromJs('property', 'value');
property: Property Name as string
value: value is a string. value may be of type Int32, Double, String, enum etc, even it can be a complex XAML like a Brush
Example:
|
<div id="VisifireChart0">
<script type="text/javascript">
var vChart = new Visifire('SL.Visifire.Charts.xap',500,300); vChart.setDataUri("Sample1.xml");
/* This event will be fired before loading the chart into Silverlight user-control. */ vChart.preLoad = function(args) { /* First Chart Reference. If there are multiple charts in a XAML file, array of chart references will be available as an event argument, e.g. args[0], args[1], args[2] etc. */ var chart = args[0];
var ds = chart.Series[0];
// String as brush. var brush1 = '<LinearGradientBrush xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"' + 'EndPoint="0.5,1" StartPoint="0.5,0">' + '<GradientStop Color="#FF000000"/>' + '<GradientStop Color="#FFFFFFFF" Offset="1"/>' + '</LinearGradientBrush>';
// Set Color of a DataSeries ds.SetPropertyFromJs("Color", brush1);
// DataPoint reference var dataPoint = ds.DataPoints[0];
// Set YValue of a DataPoint dataPoint.SetPropertyFromJs("YValue","10");
// String as brush var brush2 = '<LinearGradientBrush xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"' +' EndPoint="0.5,1" StartPoint="0.5,0">' + '<GradientStop Color="#FF000000"/>' + '<GradientStop Color="#FFFFFFFF" Offset="1"/>' + '</LinearGradientBrush>';
// Set Color of a DataPoint dataPoint.SetPropertyFromJs("Color", brush2); };
vChart.render("VisifireChart0");
</script> </div>
|
See Also