.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Silverlight >> Post New QuestionBookmark and Share Subscribe to Forum

Showing image for datapoints in Scatter series in Silverlight

Posted By: qoiuthegreat     Posted Date: March 30, 2012    Points:5   Category :Silverlight
Hi,

I want to show an image for datapoints (same image for each data point) of the scatter series.the xaml looks like this :


<UserControl.Resources>
<ImageBrush x:Key="ImageBrushStyle" ImageSource="Images\customImage.png" />
<Style x:Key="DataPointStyle1" TargetType="DVC:ScatterDataPoint">
<Setter Property="Background" Value="{StaticResource ImageBrushStyle}"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DVC:ScatterDataPoint">
<!--<Rectangle Fill="Yellow" Width="100" Height="100" />-->
<Image Source="Images\customImage.png"></Image>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<DVC:Chart Canvas.Top="80" Canvas.Left="10" x:Name="mcChart_CustomSection"
Width="800" Height="400"
Background="Gray">
<DVC:Chart.Series>
<DVC:ScatterSeries Title=" SampleData"
IndependentValueBinding="{Binding Path=Key}"
DependentValueBinding="{Binding Path=Value}">
</DVC:ScatterSeries>
</DVC:Chart.Series>
</DVC:Chart>
</Grid>
</UserControl>


Then,
The code sets the style in this way :
((ScatterSeries)mcChart_CustomSection.Series[0]).ItemsSource =
new KeyValuePair<int, int>[]{
new KeyValuePair<int, int>(1, 140),
new KeyValuePair<int, int>(2, 150)
};

var ss1 = (ScatterSeries)mcChart_CustomSection.Series[0];
mcChart_CustomSection.Series.Remove(ss1);
ss1.DataPointStyle = (Style)this.Resources["DataPointStyle1"];
mcChart_CustomSection.Series.Add(ss1);


But, it does not work.(The points are not plotted).

Is it possible to show image there(Images\customImage.png)?


Thanks.


Responses

No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend