Problems running unity in a WPF project

hi. I'm a beginner just starting to learn coding.

I'm working on adding a Unity 3D Earth to the screen in a WPF window right now.

When you start a WPF project, like this image

8871942--1211364--upload_2023-3-13_15-16-36.png

window close button not showing

8871942--1211367--upload_2023-3-13_15-17-39.png ← this

and coudln't resize and move window.

I want to display the earth screen on the 0th grid

8871942--1211370--upload_2023-3-13_15-18-43.png

My code is from the forum.

    public partial class MainWindow : ThemedWindow
    {

        [DllImport("User32.dll")]
        static extern bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw);

        internal delegate int WindowEnumProc(IntPtr hwnd, IntPtr lparam);
        [DllImport("User32.dll")]
        internal static extern bool EnumChildWindows(IntPtr hwnd, WindowEnumProc func, IntPtr lParam);

        [DllImport("User32.dll")]
        static extern int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

        private Process _process;
        private IntPtr _unityHWND = IntPtr.Zero;

        private const int WM_ACTIVATE = 0x0006;
        private readonly IntPtr WA_ACTIVE = new IntPtr(1);
        private readonly IntPtr WA_INACTIVE = new IntPtr(0);

        //Frame p = MainWindow.Instance.floatingFrame;
        Grid UnityContent;

        bool initialized = false;

        public MainWindow()
        {
            InitializeComponent();
            // this.DataContext = new ViewModels.MainViewModel();
            UnityContent = unityContent;
            //MainWindow.Instance.MainWindowClosing += Application_Exit;

            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += attemptInit;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
        void attemptInit(object sender, EventArgs e)
        {

            if (initialized)
                return;

            HwndSource source = (HwndSource)HwndSource.FromVisual(UnityContent);

            Debug.WriteLine("attempting to get handle...");

            if (source == null)
            {
                Debug.WriteLine("Failed to get handle source");
                return;
            }

            IntPtr hWnd = source.Handle;

            try
            {
                _process = new Process();
                _process.StartInfo.FileName = "path";
                _process.StartInfo.Arguments = "-parentHWND " + hWnd.ToInt32() + " " + Environment.CommandLine;
                _process.StartInfo.UseShellExecute = true;
                _process.StartInfo.CreateNoWindow = true;

                _process.Start();

                _process.WaitForInputIdle();
                // Doesn't work for some reason ?!
                //hWnd = _process.MainWindowHandle;
                EnumChildWindows(hWnd, WindowEnum, IntPtr.Zero);

                //unityHWNDLabel.Text = "Unity HWND: 0x" + unityHWND.ToString("X8");
                Debug.WriteLine("Unity HWND: 0x" + _unityHWND.ToString("X8"));

                // TODO: rename. What are the Args?
                UnityContentResize(this, EventArgs.Empty);

                initialized = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ".\nCheck if Container.exe is placed next to Earth and mooon.exe");
            }
        }

        private void ActivateUnityWindow()
        {
            SendMessage(_unityHWND, WM_ACTIVATE, WA_ACTIVE, IntPtr.Zero);
        }

        private void DeactivateUnityWindow()
        {
            SendMessage(_unityHWND, WM_ACTIVATE, WA_INACTIVE, IntPtr.Zero);
        }

        private int WindowEnum(IntPtr hwnd, IntPtr lparam)
        {
            _unityHWND = hwnd;
            ActivateUnityWindow();
            return 0;
        }

        private void UnityContentResize(object sender, EventArgs e)
        {
            MoveWindow(_unityHWND, 0, 0, (int)UnityContent.Width, (int)UnityContent.Height, true);
            Debug.WriteLine("RESIZED UNITY WINDOW TO: " + (int)UnityContent.Width + "x" + (int)UnityContent.Height);
            ActivateUnityWindow();
        }

        // Close Unity application
        private void ApplicationExit(object sender, EventArgs e)
        {
            try
            {
                _process.CloseMainWindow();

                Thread.Sleep(1000);
                while (!_process.HasExited)
                    _process.Kill();
            }
            catch (Exception)
            {

            }
        }

        private void UnityContentActivate(object sender, EventArgs e)
        {
            ActivateUnityWindow();
        }

        private void UnityContentDeactivate(object sender, EventArgs e)
        {
            DeactivateUnityWindow();
        }
    }

I've been stuck on this problem for two days.
Is there anyone who can help me?8871942--1211364--upload_2023-3-13_15-16-36.png

8871942--1211361--upload_2023-3-13_15-16-16.png

Does it show up if you don't launch the Unity content in the app?

First of all thanks for the reply.
The above problem was solved by myself. I solved it with tag and handler. thank you.

↓ here is run window
8928062--1223516--upload_2023-4-5_15-9-37.png