0

I am a new WPF user, coming from Windows Forms and I have a question regarding Windows Forms Control Integration in WPF.

Windows Forms offer a very extensive built-in Data Visualization Chart control, which I would like to use in a WPF application.

I successfully added the chart control to the application, using a WindowsFormsHost control. This is how the XAML code looks:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:winformchart="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Name="mainWindow" x:Class="WPFChartControl.MainWindow"
        Title="WPF Chart Control" Height="350" Width="525" WindowStartupLocation="CenterScreen">
    <Grid d:IsLocked="True">
        <WindowsFormsHost x:Name="chartHost" HorizontalAlignment="Left" Height="260" Margin="10,10,0,0" VerticalAlignment="Top" Width="497" d:IsLocked="True">
            <winformchart:Chart x:Name="MyChart" Dock="Fill">
                <winformchart:Chart.Series>
                    <winformchart:Series Name="series" ChartType="Line"/>
                </winformchart:Chart.Series>
                <winformchart:Chart.ChartAreas>
                    <winformchart:ChartArea/>
                </winformchart:Chart.ChartAreas>
            </winformchart:Chart>
        </WindowsFormsHost>
        <Button Content="Add Point" Click ="Button_Click" Margin="221,275,221,0" VerticalAlignment="Top" d:IsLocked="True"/>
    </Grid>
</Window>

And now my question: Is there any way to access the Chart Collection Editors (Annotations, ChartArea, Legends, Series, Titles) from Visual Studio's Property window at design time, similar to how they can be accessed when developing Windows Forms applications? I find these editors very convenient to use, compared to customizing all the chart properties from code.

Windows Forms Properties

ChartArea Collection Editor

CuriouS
  • 129
  • 1
  • 9

0 Answers0