menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartTrackballControl - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartTrackballControl

    Defines the trackball control template.

    Inheritance
    System.Object
    ChartTrackballControl
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public class ChartTrackballControl : Control

    Constructors

    ChartTrackballControl(ChartSeries)

    Declaration
    public ChartTrackballControl(ChartSeries series)
    Parameters
    Type Name Description
    ChartSeries series

    Fields

    SeriesProperty

    The DependencyProperty for Series property.

    Declaration
    public static readonly DependencyProperty SeriesProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    StrokeProperty

    The DependencyProperty for Stroke property.

    Declaration
    public static readonly DependencyProperty StrokeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    StrokeThicknessProperty

    The DependencyProperty for StrokeThickness property.

    Declaration
    public static readonly DependencyProperty StrokeThicknessProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    Properties

    Series

    Gets or sets the series associated with the trackball.

    Declaration
    public ChartSeries Series { get; set; }
    Property Value
    Type
    ChartSeries

    Stroke

    Gets or sets a brush to highlight the stroke of trakball.

    Declaration
    public Brush Stroke { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    It takes Microsoft.UI.Xaml.Media.Brush value.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
              <!--omitted for brevity-->
    
              <chart:SfCartesianChart.TrackballBehavior>
                  <chart:ChartTrackballBehavior>
                      <chart:ChartTrackballBehavior.ChartTrackballStyle>
                          <Style TargetType="chart:ChartTrackballControl">
                              <Setter Property = "Stroke" Value="Red"/>
                          </Style>
                      </chart:ChartTrackballBehavior.ChartTrackballStyle>
                  </chart:ChartTrackballBehavior>
              </chart:SfCartesianChart.TrackballBehavior>
    
              <chart:LineSeries ItemsSource="{Binding Data}"
                                XBindingPath="XValue"
                                YBindingPath="YValue"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
       // omitted for brevity
       var trackballStyle = new Style() { TargetType = typeof(ChartTrackballControl) };
       trackballStyle.Setters.Add(new Setter(ChartTrackballControl.StrokeProperty, new SolidColorBrush(Colors.Red)));
       chart.TrackballBehavior = new ChartTrackballBehavior()
       {
          ChartTrackballStyle = trackballStyle,
       };
    
        LineSeries series = new LineSeries();
        series.ItemsSource = viewModel.Data;
        series.XBindingPath = "XValue";
        series.YBindingPath = "YValue";
        chart.Series.Add(series);

    StrokeThickness

    Gets or sets a value for stroke thickness.

    Declaration
    public double StrokeThickness { get; set; }
    Property Value
    Type Description
    System.Double

    This property takes a double value and its default value is 1.

    Examples
    • Xaml
    • C#
        <chart:SfCartesianChart>
    
              <!--omitted for brevity-->
    
              <chart:SfCartesianChart.TrackballBehavior>
                  <chart:ChartTrackballBehavior>
                      <chart:ChartTrackballBehavior.ChartTrackballStyle>
                          <Style TargetType="chart:ChartTrackballControl">
                              <Setter Property = "StrokeThickness" Value="2"/>
                          </Style>
                      </chart:ChartTrackballBehavior.ChartTrackballStyle>
                  </chart:ChartTrackballBehavior>
              </chart:SfCartesianChart.TrackballBehavior>
    
              <chart:LineSeries ItemsSource="{Binding Data}"
                                XBindingPath="XValue"
                                YBindingPath="YValue"/>
    
        </chart:SfCartesianChart>
        SfCartesianChart chart = new SfCartesianChart();
        ViewModel viewModel = new ViewModel();
    
       // omitted for brevity
       var trackballStyle = new Style() { TargetType = typeof(ChartTrackballControl) };
       trackballStyle.Setters.Add(new Setter(ChartTrackballControl.StrokeThicknessProperty, 2));
       chart.TrackballBehavior = new ChartTrackballBehavior()
       {
          ChartTrackballStyle = trackballStyle,
       };
    
        LineSeries series = new LineSeries();
        series.ItemsSource = viewModel.Data;
        series.XBindingPath = "XValue";
        series.YBindingPath = "YValue";
        chart.Series.Add(series);
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved