SciChart WPF 3D Charts > ChartModifier3D API > Selection > Vertex Selection Modifier
Vertex Selection Modifier

Ther VertexSelectionModifier3D allows you to perform selection of points on a 3D Chart.

 

 

Declaring a VertexSelectionModifier3D in XAML

Declaring a VertexSelectionModifier3D is as simple as adding one to the SciChart3DSurface.ChartModifier property. This can be done as a single modifier, or as part of a ModifierGroup3D.

 

<s3D:SciChart3DSurface x:Name="scs" >
   
    <!-- XAxis, YAxis, RenderableSeries omitted for brevity -->       
   
    <s3D:SciChart3DSurface.ChartModifier>
        <s3D:ModifierGroup3D>
            <!-- Add the VertexSelectionModifier3D to the chart. Optional. add other modifiers -->
            <s3D:VertexSelectionModifier3D ExecuteOn="MouseLeftButton" />        
        </s3D:ModifierGroup3D>
    </s3D:SciChart3DSurface.ChartModifier>
   
</s3D:SciChart3DSurface>
var sciChart3DSurface = new SciChart3DSurface();
// XAxis, YAxis, RenderableSeries omitted for brevity
var modifierGroup = new ModifierGroup3D();
modifierGroup.ChildModifiers.Add(new VertexSelectionModifier3D () {
    IsEnabled = true,
    ExecuteOn = ExecuteOn.MouseLeftButton,
});
sciChart3DSurface.ChartModifier = modifierGroup;

 

Binding to Selected Points

The VertexSelectionModifier3D modifies the XyzDataSeries3D and adds or updates a PointMetadata3D object at each index with the flag PointMetadata3D.IsSelected = true.

 

In the example Chart Data-Point Selection Example we demonstrate how you can update a ListBox with selected points by listening to the DataSeriesChanged event.

e.g.

Example Title
Copy Code
_xyzDataSeries3D = new XyzDataSeries3D<double>();
            
_xyzDataSeries3D.DataSeriesChanged += (s,e) =>
{
    List<XyzDataPointViewModel<double>> selectedPoints = new List<XyzDataPointViewModel<double>>();
    for (int i = 0; i < _xyzDataSeries3D.Count; i++)
    {
        if (_xyzDataSeries3D.WValues[i] != null)
        {
            // If the IsSelected flag is true
            if (_xyzDataSeries3D.WValues[i].IsSelected)
            {
                // collect this selected point
                selectedPoints.Add(new XyzDataPointViewModel<double>(i,
                    _xyzDataSeries3D.XValues[i],
                    _xyzDataSeries3D.YValues[i],
                    _xyzDataSeries3D.ZValues[i],
                    _xyzDataSeries3D.WValues[i]));
            }
        }
    }
    if (!selectedPoints.IsNullOrEmpty())
    {
        listBox.Visibility = Visibility.Visible;
        listBox.ItemsSource = selectedPoints;
    }
    else listBox.Visibility = Visibility.Collapsed;
};

where the ListBox is defined in XAML.

See the Chart Data-Point Selection Example for more information.