I am trying to change the track ball info, but I cannot figure out the right combination to get the data to come out the way I need it to come out. I want to show an identifier for a line series in much the same way that the ChartView demo does, but in that demo, the series and format strings are encoded into the XAML. In my app, there can be any number of line series, so they need to be created programmatically.
Here is the class that holds the data:
And here is where I am creating the data and setting the item source of my line series:
And finally the template in the resources:
I cannot figure out how to get this bound correctly so that I can see the Employee name in the track ball info. I get the Value fine, and if I use DataPoint.Category, I can get the date, but I just cannot figure out how to get the Employee to show up in that first TextBlock in the template. Thanks.
Here is the class that holds the data:
public
class
SalesInfo
{
public
string
Employee {
get
;
set
; }
public
DateTime Time {
get
;
set
; }
public
int
Value {
get
;
set
; }
}
And here is where I am creating the data and setting the item source of my line series:
data =
new
RadObservableCollection<SalesInfo>(data.OrderBy(x => x.Time));
Color dataColor = colorArray[loopCounter % 4];
LineSeries line =
new
LineSeries();
line.Stroke =
new
SolidColorBrush(dataColor);
line.StrokeThickness = 2;
line.CategoryBinding =
new
PropertyNameDataPointBinding() { PropertyName =
"Time"
};
line.ValueBinding =
new
PropertyNameDataPointBinding() { PropertyName =
"Value"
};
line.ItemsSource = data;
var tbiTemplate =
this
.Resources[
"theTemplate"
]
as
DataTemplate;
line.TrackBallInfoTemplate = tbiTemplate;
activitiesAddedChart.Series.Add(line);
And finally the template in the resources:
<
DataTemplate
x:Key
=
"theTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding DataPoint.SalesInfo.Employee}"
/>
<
TextBlock
Text
=
": "
/>
<
TextBlock
Text
=
"{Binding DataPoint.Value}"
/>
</
StackPanel
>
</
DataTemplate
>
I cannot figure out how to get this bound correctly so that I can see the Employee name in the track ball info. I get the Value fine, and if I use DataPoint.Category, I can get the date, but I just cannot figure out how to get the Employee to show up in that first TextBlock in the template. Thanks.