Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @DevExpressExampleBot
27 changes: 15 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128569950/24.2.1%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T500832)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
<!-- default badges end -->
<!-- default file list -->
*Files to look at*:

* **[MainWindow.xaml](./CS/MvvmChart/MainWindow.xaml) (VB: [MainWindow.xaml](./VB/MvvmChart/MainWindow.xaml))**
* [MainWindow.xaml.cs](./CS/MvvmChart/MainWindow.xaml.cs) (VB: [MainWindow.xaml.vb](./VB/MvvmChart/MainWindow.xaml.vb))
* [ViewModel.cs](./CS/MvvmChart/ViewModel.cs) (VB: [ViewModel.vb](./VB/MvvmChart/ViewModel.vb))
<!-- default file list end -->
# How to generate Series of different view types using the MVVM binding style
# Chart for WPF - Use the MVVM Binding Style to Generate Series of Different View Types

This example generates different Series from a view model. Clicking on a series changes its type from Line to Range Area.

<p>This example demonstrates how to generate different Series from a view model. Note that you can bind secondary axes and custom labels using the same approach. The XYDiagram2D.<strong>SeriesItemsSource </strong>property defines a collection of objects used to generate Series. To configure how the series view model is converted to a series on a chart, use the XYDiagram2D.<strong>SeriesItemTemplateSelector</strong> property.<br><br>See also: <a href="https://www.devexpress.com/Support/Center/p/T513360">How to generate Series of identical view types using the MVVM binding style</a>.</p>
![Chart](./images/chart.png)

## Implementation Details

<h3>Description</h3>
The `XYDiagram2D.SeriesItemsSource` property defines a collection of objects used to generate Series. To bind series view models to a chart, use the `SeriesItemsSource` property of a diagram. To configure how the series view model converts to a series on a chart, use `SeriesItemTemplate` or `SeriesItemTemplateSelector`. In this example, the Template Selector converts the selected series type from Line to Range Area.

<p>To bind series view models to a chart, use the SeriesItemsSource property of a diagram. To configure how the series view model converts to a series on a chart, use SeriesItemTemplate or SeriesItemTemplateSelector. In this example, the Template Selector is used to convert the selected series type from Line to Range Area.</p>
Note that you can bind secondary axes and custom labels using the same approach. 

<br/>
## Files to Review

<!-- default file list -->

* **[MainWindow.xaml](./CS/MvvmChart/MainWindow.xaml) (VB: [MainWindow.xaml](./VB/MvvmChart/MainWindow.xaml))**
* [MainWindow.xaml.cs](./CS/MvvmChart/MainWindow.xaml.cs) (VB: [MainWindow.xaml.vb](./VB/MvvmChart/MainWindow.xaml.vb))
* [ViewModel.cs](./CS/MvvmChart/ViewModel.cs) (VB: [ViewModel.vb](./VB/MvvmChart/ViewModel.vb))
<!-- default file list end -->
## More Examples

[Chart for WPF - Use the MVVM Binding Style to Generate Series of an Identical View Type](https://github.com/DevExpress-Examples/wpf-charts-create-multiple-series-of-identical-view-mvvm)
<!-- feedback -->
## Does this example address your development requirements/objectives?

Expand Down