1. PlotView. xaml in the view
<Button Content = "& lt; "Height =" 23 "HorizontalAlignment =" Right "Name =" button2 "verticalignment =" Center "Width =" 30 "Click =" button2_Click "Margin =" 0, 40, 0 "/>
2. PlotView. xaml. CS in the cs file of the View
Private int SelectedBarNo =-1;
Private void button2_Click (object sender, RoutedEventArgs e)
{
PlotViewModel pvm = this. DataContext as PlotViewModel;
SelectedBarNo =-1;
If (pvm! = Null)
{
Pvm. BarNo = SelectedBarNo;
Pvm. SetInfo (SelectedBarNo );
}
TChart1.Page. Previous ();
If (tChart1.Series. Count> 0)
TChart1.Series [0]. Repaint ();
}
3. PlotViewModel. cs in ViewModel
# Region setting info
Public void SetInfo (int BarNo)
{
.....
}
# Region override Function
Public override DataTemplate GetTemplate ()
{
Return ViewTemplate. This. PlotTemplate;
}
# Endregion
4. In MainView. xaml
<DataTemplate DataType = "{x: Type local: PlotViewModel}" x: Key = "PlotTemplate">
<Local: PlotView AxesStyle = "{Binding Axes, Mode = TwoWay}" PaintLine = "{Binding Paint, Mode = TwoWay}"/>
</DataTemplate>