Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
ScatterLineSeries and Tooltip created in CodeBehind
posted

Hi,

I try to display several ScatterLineSeries in one xamDadaChart. Since they are unknown in count at designtime, I have to add them in code behind.

Previous first steps were made in LineSeries. Therein I managed to add a ToolTip in Code behind as well displaying Value and TimeStamp while hovering over the chart.

Now I was hoping that I would be able to simply copy and paste that snippet and it would work - I know, a little naive for a developer (I hope that caused a smile). You might have guessed it already, it did NOT work.

The following snippet compiles and runs. Unfortunately, it does not show up in the chart:

ScatterLineSeries series = new ScatterLineSeries();

//some more code to initialize the scatter series


//end of the initialisation

StackPanel sp = new StackPanel()
{
  Orientation = System.Windows.Controls.Orientation.Vertical
};

var txtbl = new TextBlock();
txtbl.SetBinding(TextBlock.TextProperty, new Binding("Series.Title"));
sp.Children.Add(txtbl);

txtbl = new TextBlock();
txtbl.SetBinding(TextBlock.TextProperty, new Binding("Item.Value"));
sp.Children.Add(txtbl);

txtbl = new TextBlock();
txtbl.SetBinding(TextBlock.TextProperty, new Binding("Item.DateString"));
sp.Children.Add(txtbl);

series.ToolTip = sp;

Parents Reply Children
No Data