Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to Add Winform's MSChart into WPF application

$
0
0

Hi,

  I wanted to add the winform's chart control (Namespace:System.Windows.Forms.DataVisualization.Charting) into the WPF, but I am not able to add it. My existing XAML code looks like this;

<Windowx:Class="FlowMovementUsingProgressBar.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"xmlns:MSChart="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"Title="MainWindow"Height="474"Width="810"xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"><Grid><WindowsFormsHostMargin="482,12,0,65"Name="WfHost"><MSChart:Chartx:Name="MyWinformChart"/></WindowsFormsHost></Grid>

Now when I make various chart operations in my button click event I don't get any update on the screen. Everything is blank. :(

privatevoid button2_Click(object sender, RoutedEventArgs e)
    {
      MyChart = this.FindName("MyWinformChart") as Chart;//various chart operations
      ....
      ....

    }

Could some please helpCand let me know how to add MSChart(System.Windows.Forms.DataVisualization.Charting Namespace) in WPF application?

Thanks & Regards,

Anand Shanbhag


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>