Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecified element is already the logical child of another element. Disconnect it first”
    primarykey
    data
    text
    <p>i have user control that contain grid and inside it there is expander the problem is when i try to open new window that uses this user control i get an exception " Specified element is already the logical child of another element. Disconnect it first"<br> here is my code and its work when first windows created and the exception occur when show the second window</p> <pre><code> &lt;UserControl x:Class="DiagramDesigner.WindowsUserControl" 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:s="clr-namespace:DiagramDesigner" xmlns:c="clr-namespace:DiagramDesigner.Controls" mc:Ignorable="d" d:DesignHeight="700" d:DesignWidth="1000"&gt; &lt;UserControl.Resources&gt; &lt;ContextMenu x:Key="DesignerCanvasContextMenu"&gt; &lt;MenuItem Header="Paste" Command="{x:Static ApplicationCommands.Paste}"&gt; &lt;MenuItem.Icon&gt; &lt;Image Source="Resources/Images/Paste.png" Width="16"/&gt; &lt;/MenuItem.Icon&gt; &lt;/MenuItem&gt; &lt;MenuItem Header="Select All" Command="{x:Static s:DesignerCanvas.SelectAll}"/&gt; &lt;/ContextMenu&gt; &lt;/UserControl.Resources&gt; &lt;Grid Margin="10"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid Grid.Row="1" Margin="0,10,0,0"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;!-- Toolbox --&gt; &lt;StackPanel Grid.Column="0" Margin="0,0,5,0"&gt; &lt;Expander Header="Flow Chart" Content="{StaticResource FlowChartStencils}" IsExpanded="True" /&gt; &lt;/StackPanel&gt; &lt;!-- GridSplitter --&gt; &lt;GridSplitter Focusable="False" Width="2" Background="LightGray" VerticalAlignment="Stretch" HorizontalAlignment="Right"/&gt; &lt;!-- Designer --&gt; &lt;GroupBox Header="Diagram" Grid.Column="1" Margin="3,0,0,0"&gt; &lt;ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"&gt; &lt;s:DesignerCanvas Focusable="true" x:Name="MyDesigner" Background="{StaticResource WindowBackgroundBrush}" Margin="10" FocusVisualStyle="{x:Null}" ContextMenu="{StaticResource DesignerCanvasContextMenu}"/&gt; &lt;/ScrollViewer&gt; &lt;/GroupBox&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload