How to remove a WPF control, such as a Grid, from the main xaml file to a separate one. Then, how to connect it in the main xaml file? I would be very grateful if you give an example with xaml.
1 answer
Then put your Grid into it:
<UserControl x:Class="GM_Assistant.Windows.UserControl1" 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" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> </Grid> </UserControl> After - add the namespace with your control to the main file and use it:
<Window x:Class="WPFProject1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:uc="clr-namespace:WPFProject1.UserControls" Title="Window1" Height="300" Width="300"> <Grid> <uc:UserControl1/> </Grid> </Window> |
