You could try to refer to the steps below to see if it suits you.
Project A:
MainWindow.xaml:
<Grid>
<Button Click="Button_Click" Width="100" Height="40" Content="click"/>
</Grid>
MainWindow.xaml.cs:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
namespace ClickButtonToOpenProgram
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Process p = Process.Start("BackgroundOfCanvas");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, Process.GetCurrentProcess().MainWindowHandle);
}
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
}
}
Project B:
<Canvas Opacity="0.9">
<Path Fill="Black" Data="M0,0 L1000,0 1000,1000 0,1000Z M100,100 L200,100 200,200 100,200Z"/>
<Rectangle Fill="LightGreen" Height="100" Width="100" Margin="200"/>
<TextBlock Text="hello" Background="AliceBlue" Height="40" Width="100" />
</Canvas>
Right-click the Reference of Project A, select Add Reference... and then check Project B.Finally click Ok.
The result