This example shows how to select a point marker type depending on a point argument.
-
Create a subclass of DataTemplateSelector, override the SelectTemplate method to create a custom date template selector, and provide logic to select an appropriate marker type.
-
Use ContentControl to specify the CustomMarker2DModel.PointTemplate property.
-
Assign the custom data template selector object to the ContentControl.ContentTemplateSelector property.
<dxc:ChartControl>
<dxc:XYDiagram2D EnableAxisXNavigation="True">
<dxc:LineSeries2D
DataSource="{Binding DataItems, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
MarkerVisible="True"
ArgumentDataMember="DateTimeStamp"
ValueDataMember="Value">
<dxc:LineSeries2D.MarkerModel>
<dxc:CustomMarker2DModel>
<dxc:CustomMarker2DModel.PointTemplate>
<ControlTemplate>
<ContentControl
Content="{Binding SeriesPoint}"
ContentTemplateSelector="{StaticResource myDataTemplateSelector}"/>
</ControlTemplate>
</dxc:CustomMarker2DModel.PointTemplate>
</dxc:CustomMarker2DModel>
</dxc:LineSeries2D.MarkerModel>
</dxc:LineSeries2D>
</dxc:XYDiagram2D>
</dxc:ChartControl>
(you will be redirected to DevExpress.com to submit your response)