Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5843137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:06:45+00:00 2026-05-22T12:06:45+00:00

<Page x:Class=Project.ProjectDiagramView 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=850 d:DesignWidth=1000 Title=Project Diagram> <Grid

  • 0
<Page x:Class="Project.ProjectDiagramView"
      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="850" d:DesignWidth="1000"
    Title="Project Diagram">    

    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ContentControl Content="{StaticResource MyToolbar}"/>
        <Grid Grid.Row="1" Margin="0,10,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="135" MaxWidth="135"/>
                <ColumnDefinition Width="*" />
                <ColumnDefinition MaxWidth="500" MinWidth="350" />
            </Grid.ColumnDefinitions>

            <!-- Toolbox -->
            <StackPanel Grid.Column="0" Margin="0,0,5,0">
                <!--<Expander Header="Symbols" Content="{StaticResource SymbolStencils}" IsExpanded="True"/>-->
            </StackPanel>
            <!-- GridSplitter -->
            <GridSplitter Focusable="False" Width="2" Background="LightGray"
                    VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
            <!-- Designer -->
            <GroupBox Header="Diagram" Grid.Column="1" Margin="3,0,3,0">
                <ScrollViewer HorizontalScrollBarVisibility="Auto"
                      VerticalScrollBarVisibility="Auto">
                    <s:DesignerCanvas Focusable="true" x:Name="MyDesigner"
                            Background="{StaticResource WindowBackgroundBrush}"
                            Margin="10" FocusVisualStyle="{x:Null}" />
                </ScrollViewer>
            </GroupBox>

            <GroupBox Header="Diagram" Grid.Column="3" Margin="3,0,0,0">
                <ScrollViewer HorizontalScrollBarVisibility="Auto"
                      VerticalScrollBarVisibility="Auto">
                    <s:SelectedDesignItem />
                </ScrollViewer>
            </GroupBox>
        </Grid>
    </Grid>
</Page>

This is the Diagram Designer i am using from codeproject, the above code gives error second time it is loaded

‘Set property ‘System.Windows.Controls.ContentControl.Content’ threw an exception.’ Line number ’24’ and line position ’10’.

first time when the page is loaded, works perfectly, but navigating to the same page second time it thorws error, i am clueless about the error

I have tried to comment the toolbox, it works perfectly then, is toolbox not getting disposed, i dont know.

please can any one guide me.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:06:46+00:00Added an answer on May 22, 2026 at 12:06 pm

    The XAML that you are using is not designed to ever be loaded twice. The line that causes the error is a ContentControl setting its Content property to a StaticResource. As you say, you are loading it twice so there are two instances of the ContentControl but there is only one instance of the static resource. WPF will not allow the same element to belong to two different visual trees and therefore on the second load you get the error message, I believe:

    Specified element is already the logical child of another element

    To fix this problem would require a fair amount of rework. One approach is to convert the direct static content of the content control into a template, but without knowing how the application is structured, it’s hard to say if this would work easily or just create new problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class Project has_many :pages end class Page belongs_to :project end @project = Project.first @project.pages.list_out
I just wrote some new utility methods within a non-page class for an existing
I have to open a page from class extended from javax.swing.AbstractAction class... Is that
<?php class Page { function getPage($urlOfPage){ $result = mysql_query('SELECT category, title FROM rs-planet WHERE
I've got a set of models that look like this: class Page(models.Model): title =
I have the following types and classes: namespace MVC.Models public class Page { public
In C#, I have a class set up like so: class Page { public
Given this class public partial class Default : Page { private IRepository repo; ...
At MSDN page for Stopwatch class I discovered link to interesting article which makes
I reference the current page in a class with Page page = HttpContext.Current.CurrentHandler as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.