Hi everyone, I'm new here and have used this site very frequently for help. It is a great resource so far, and I'm happy to say it has helped a lot. I'm primarily an engineer/embedded guy, but I'm needed to work on some GUI's and communication protocols. I've only been doing c# or any OOP language for about a month so bear with me.
I've got my base communication and background coded in winforms and I need to start using wpf for animations and the GUI. Unfortunately, my timer graphical system in winforms lags on slower computers and is unacceptable.
I've found very few topics on opening a wpf window from winforms. I've attached my project which has an error in referencing the namespace. I've used the same references in both the wpf and winforms projects that are in my solution. The code is as follows.
winforms code...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
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;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var wpfWindow = new WpfApplication1.MainWindow();
wpfWindow.Show();
}
}
}
The wpf code...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
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;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
The error is here...
Error 1 The type or namespace name 'WpfApplication1' could not be found (are you missing a using directive or an assembly reference?) C:\Users\alna072683\Desktop\wpftowin\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 34 33 WindowsFormsApplication1
If anyone could let me know what I'm doing wrong that would be great!