Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

CustomBar2DModel Class

The custom 2D Bar model.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

#Declaration

public class CustomBar2DModel :
    Bar2DModel

#Remarks

To provide a custom 2D Bar model, create an instance of the CustomBar2DModel class, and assign it to the BarSeries2D.Model property.

To apply a pre-defined 2D Bar model in your chart, use the corresponding descendant of the PredefinedBar2DModel class.

#Example

This example illustrates how to create custom bar models.

To do this, create an object that represents a custom model of a particular series (CustomBar2DModel) and assign it to the Model property of a corresponding series type (BarSeries2D.Model).

Then, create the ControlTemplate object which contains all necessary visual elements to create your own custom model. Assign this template to the PointTemplate property of a series custom model (CustomBar2DModel.PointTemplate).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CustomBarModels
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

#Inheritance

See Also