XAML:
<DataTemplate x:Key="LabelTemplate">
<StackLayout Orientation="Horizontal" BackgroundColor="Transparent" Padding="5">
<Label x:Name="label" Text="{Binding YValue}" >
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLabelClicked"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</DataTemplate>
C#:
private void OnLabelClicked(object sender, EventArgs e)
{
// code for Nativate the page
}
|
Hello Thanks for your reply-
the issue I have is that the label should behave exactly as is doing the event I am raising by the chart when user click the chart bar.
In this case the event I am calling is the
void AssetsDetailsChart_SelectionChanging(object sender, ChartSelectionChangingEventArgs e)
in which I am getting the index of the bar selected using e.SelectedDataPointIndex;
Any way to apply it to the label as well to be coherent whit what doing the bar?
private void OnLabelClicked(object sender, EventArgs e)
{
var viewModel = Chart.BindingContext as ChartViewModel;
var list = viewModel.NumericData as System.Collections.IList;
var item = (sender as Label).BindingContext as Model;
int index = list.IndexOf(item);
}
|
Super!
It works :)