The question is most likely very naive, but I just can not find the appropriate answer. There is a main program written in C #. From it you need to create a new window.
Inserted XML element. Added it manually.
<UserControl x:Class="Nevatec_Demo.Ship.UserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Nevatec_Demo" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="450"> <Canvas> <Path Name="_ShipProfile" Canvas.Top="15" Canvas.Left="-16" Fill=" Red" Stroke="Gainsboro" StrokeThickness="2" Data="M 90, 30 L 90, 90 ... Z" DataContext="{Binding}"></Path> <Path Name="_Arrow" Canvas.Top="0" Canvas.Left="0" StrokeThickness="5" Stroke="Green" Data="M 200,30 L120,30 ..." Height="43" Width="450"></Path> </Canvas> </UserControl>
The question is how to connect it to the main program?
Dop .: When going to the code, ship.xaml.cs is created:
// ... namespace Nevatec_Demo { public partial class Ship : Form1 { public Ship() { InitializeComponent(); } } }
This InitilizeComponent
is "unavailable due to its level of protection." I would like this window to open as a child and control elements _ShipProfile
and _Arrow
was from the main code.