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 8482613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:51:58+00:00 2026-06-10T19:51:58+00:00

I have a button style where I have some Path seth in Content property.

  • 0

I have a button style where I have some Path seth in Content property. That is working fine until I display a second instance of this button. I am getting an exception

Specified element is already the logical child of another element. Disconnect it first.

Other posts like this:

Error "Specified element is already the logical child of another element"?

led me to a solution that I need to transfer Content to ContentTemplate.

<Viewbox>
    <Grid Margin="0,0,30,30">
        <Path Fill="#FFFFFFFF">
            <Path.Data>
                <PathGeometry Figures="m 13.123027 65.796864 0 81.448876 133.750213 0 0 -133.778725 -67.192062 0 z" FillRule="NonZero"/>
            </Path.Data>
        </Path>
        <Path Fill="{StaticResource DataCRUDIconBrush}">
            <Path.Data>
                <PathGeometry Figures="M 79.624708 0.36218262 0 62.950511 l 0 97.411669 160 0 0 -159.99999738 -80.375292 0 z m 2.28303 16.89635038 61.172792 0 0 126.207297 -126.161061 0 0 -76.829978 0.187646 -0.156158 64.800623 0 0 -49.221161 z" FillRule="NonZero"/>
            </Path.Data>
        </Path>
        <Path Fill="#FFFFFFFF">
            <Path.Data>
                <PathGeometry Figures="m 13.123027 65.796864 0 81.448876 133.750213 0 0 -133.778725 -67.192062 0 z" FillRule="NonZero"/>
            </Path.Data>
            <Path.RenderTransform>
                <TranslateTransform X="30" Y="30"/>
            </Path.RenderTransform>
        </Path>
        <Path Fill="{StaticResource DataCRUDIconBrush}">
            <Path.Data>
                <PathGeometry Figures="M 79.624708 0.36218262 0 62.950511 l 0 97.411669 160 0 0 -159.99999738 -80.375292 0 z m 2.28303 16.89635038 61.172792 0 0 126.207297 -126.161061 0 0 -76.829978 0.187646 -0.156158 64.800623 0 0 -49.221161 z" FillRule="NonZero"/>
            </Path.Data>
            <Path.RenderTransform>
                <TranslateTransform X="30" Y="30"/>
            </Path.RenderTransform>
        </Path>
    </Grid>
</Viewbox>

How can I translate this code to fit the ContentTemplate, without loosing the triggers I hava there?

<Setter.Value>
    <ControlTemplate TargetType="Button">
    ....
        <ContentPresenter x:Name="Content" Opacity="0.5" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
    </ControlTemplate>
</Setter.Value>
  • 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-06-10T19:51:59+00:00Added an answer on June 10, 2026 at 7:51 pm

    I know your problem. You are using data binding for the ContentPresenter.Content property.
    And in this case, you need to be sure, that your binding object is not a visual element. It is very important. Disconnection from logical tree is not a good solution (just ‘bottle-necks’, another words).
    Content can contains only non-visual objects. All visual parts of your control should be in its ContentPresenter.ContentTemplate property and no another way.

    Thus I think all your code with graphics should be placed in the ContentTemplate property. If you have troubles with it, please, share your entire sample and I try to help you, as much i can.

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

Sidebar

Related Questions

I have some item content that is working just fine... but shows up as
I have a Button Style: <Style x:Key=ButtonStyle1 TargetType={x:Type Button}> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType={x:Type
I have the following piece of code that generate a jquerymobile-style button <a href=#
I have a style for button. That style contains the ControlTemplate for Button. The
i have button with this style: <Style TargetType=Button x:Key=btnStyle> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=Button>
I'm using Google Chrome Developer Kit, I have a button with some CSS style
I have a WPF button style below: <Style x:Key=myButtonStyle TargetType={x:Type Button}> <Setter Property=Template> <Setter.Value>
I have created a default style for a Button including a custom ControlTemplate like
I have button that a user selects and I pop up a AlertDialog to
I have button in my application that opens android contact application for choose contact

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.