This is a migrated thread and some comments may be shown as answers.

LineSeries PointTemplate Issue

1 Answer 46 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Lampros
Top achievements
Rank 1
Lampros asked on 22 Mar 2014, 11:47 PM
Hello,

I'm trying to create a custom LineSeries.PointTemplate in a ChartView control using the following xaml:

‚Äč <telerik:LineSeries Name="lineSeries" ItemsSource="{Binding}" ValueBinding="Availability" CategoryBinding="ReportDate">
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Button Width="10" Height="10" ToolTipService.ToolTip="Show Report for this month..." Click="Button_Click"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>

and I have the following problems:
- The button defined in the template is displayed correctly, but is inactive/disabled.
- How can I set the content of the button via a binding property of the Chart's DataContext or the label value of the point?

Regards,

Stergios

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 26 Mar 2014, 09:20 AM
Hello Stergios,

In order to interact with the buttons in your PointTemplate you can set the IsHitTestVisible property of your LineSeries to True. Note that hit testing is the mechanism by which the Silverlight process input. You can read more about it in the Hit Testing and Input Events MSDN article.

As for your second requirement you can use the DataItem property to access the business object that represents the data associated with a DataPoint.
<telerik:LineSeries.PointTemplate>
    <DataTemplate>
        <Button Width="20" VerticalContentAlignment="Top" 
                Height="20"
                Content="{Binding DataItem.YValue}"
                ToolTipService.ToolTip="Show Report for this month..."
                Click="Button_Click"/>
    </DataTemplate>
</telerik:LineSeries.PointTemplate>

You can also take a look at the selection behavior of the chart view.

Regards,
Martin
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
ChartView
Asked by
Lampros
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or