Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Specified element is already the logical child of another element. Disconnect it first : with XamRibbon
posted

I have this style set for RibbonTabItem

        <Style x:Key="styleRibbonTabItemStaticData" TargetType="{x:Type Ribbon:RibbonTabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Image x:Name="image1" Height="32" Width="160" Visibility="Collapsed" Source="/XXXX;component/Images/XXXX.jpg"/>
                        </StackPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

Under that I have a Ribbon Menu setup, as below :

<Grid>
        <xctk:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="{Binding BusyMessage}">
            <Grid Name="layoutRoot">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Ribbon:RibbonWindowContentHost>
                    <Ribbon:RibbonWindowContentHost.Ribbon>
                        <Ribbon:XamRibbon Theme="[Current]" IsMinimized="{Binding IsRibbonMinimized, Mode=TwoWay}" QuickAccessToolbarLocation="BelowRibbon" >
                            <igRibbon:XamRibbon.ApplicationMenu>
                                <igRibbon:ApplicationMenu Caption="MYAPPLICATION" >
                                    <igRibbon:ApplicationMenu.Items>
                                        <igRibbon:MenuTool Caption="Theme" SmallImage="Images\Menu\theme_icon.png" ButtonType="DropDown" Height="300">
                                            <igRibbon:RadioButtonTool Caption="Aero" Tag="Aero" Click="ChangeTheme" Height="50"/>
                                            <igRibbon:RadioButtonTool Caption="Metro" Tag="Metro" Click="ChangeTheme" Height="50"/>
                                            <igRibbon:SeparatorTool/>
                                            <igRibbon:RadioButtonTool Caption="Office 2010 Blue"  IsChecked="True" Tag="Office2010Blue" Click="ChangeTheme" Height="50"/>
                                            <igRibbon:RadioButtonTool Caption="Office 2007 Black" Tag="Office2k7Black" Click="ChangeTheme" Height="50"/>
                                            <igRibbon:SeparatorTool/>
                                            <igRibbon:RadioButtonTool Caption="Onyx" Tag="Onyx" Click="ChangeTheme" Height="50"/>
                                        </igRibbon:MenuTool>

                                        <igRibbon:SeparatorTool Height="3" Visibility="Hidden"/>
                                        <igRibbon:ButtonTool Caption="About Us" Height="200" Visibility="Hidden" Click="ButtonTool_AboutUs_Click" />
                                        <igRibbon:ButtonTool Caption="Help" Height="200" Visibility="Hidden" Click="ButtonTool_Help_Click" />

                                        <igRibbon:SeparatorTool Height="3"/>
                                        <igRibbon:ButtonTool Caption="Exit" SmallImage="Images\Menu\log_out_icon.png"
                                                             LargeImage="Images\Menu\log_out_icon32.png" Height="200" Click="ButtonTool_Exit_Click" />
                                    </igRibbon:ApplicationMenu.Items>

                                    <igRibbon:ApplicationMenu.FooterToolbar>
                                        <igRibbon:ApplicationMenuFooterToolbar>
                                            <igRibbon:ButtonTool Caption="Exit" SmallImage="Images\Menu\log_out_icon.png" Width="70" Click="ButtonTool_Exit_Click"/>
                                        </igRibbon:ApplicationMenuFooterToolbar>
                                    </igRibbon:ApplicationMenu.FooterToolbar>
                                </igRibbon:ApplicationMenu>
                            </igRibbon:XamRibbon.ApplicationMenu>

                            <Ribbon:XamRibbon.Tabs>
                                <Ribbon:RibbonTabItem Header="MY_MENU_ITEM">
                                        .
                                        .
                                        .
                                        .
                                </Ribbon:RibbonTabItem>
                                <Ribbon:RibbonTabItem Header="MY_MENU_ITEMx">
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" igRibbon:RibbonGroup.MaximumSize ="ImageAndTextLarge" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>                                    
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >                                        
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                </Ribbon:RibbonTabItem>
                                <Ribbon:RibbonTabItem Header="MY_MENU_ITEM">
                                        .
                                        .
                                        .
                                        .
                                </Ribbon:RibbonTabItem>
                                <Ribbon:RibbonTabItem  Header="MY_MENU_ITEM">
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                    
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                    
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                    
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                </Ribbon:RibbonTabItem>
                            
                                <Ribbon:RibbonTabItem  Header="MY_MENU_ITEM">
                                    <Ribbon:RibbonGroup Caption="MY_MENU_ITEM" >
                                        .
                                        .
                                        .
                                        .
                                    </Ribbon:RibbonGroup>
                                </Ribbon:RibbonTabItem>

                                <Ribbon:RibbonTabItem Name="Search" Header="Search" Visibility="Hidden">
                                    <Ribbon:RibbonTabItem.Content>
                                        <Ribbon:ToolHorizontalWrapPanel>
                                            <Ribbon:ButtonGroup>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEMx" Caption="MY_MENU_ITEM"  Command="{x:Static utils:ViewModel.NewCommand}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.MY_MENU_ITEM}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.MY_MENU_ITEMx}"/>
                                                <Ribbon:SeparatorTool Width="15"/>

                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:MY_MENU_ITEM.MY_MENU_ITEM}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.CancelCommand}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Name="MY_MENU_ITEM" Caption="MY_MENU_ITEMx" Command="{x:Static utils:ViewModel.RefreshCommand}"/>

                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Name="CloseTab" Caption="_Close" Command="{x:Static utils:ViewModel.CloseTabCommand}"/>
                                                
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.ExportCommand}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.SendReportCommand}"/>
                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.ReSendReportCommand}"/>

                                                <Ribbon:ButtonTool Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.ApproveTemplateCommand}"/>
                                                <Ribbon:ButtonTool  Id="MY_MENU_ITEM" Caption="MY_MENU_ITEM" Command="{x:Static utils:ViewModel.DownloadTemplateCommand}"/>
                                            </Ribbon:ButtonGroup>
                                            <navuc:SearchParameterView x:Name="SearchParameterView" />

                                        </Ribbon:ToolHorizontalWrapPanel>
                                    </Ribbon:RibbonTabItem.Content>
                                </Ribbon:RibbonTabItem>
                            </Ribbon:XamRibbon.Tabs>

                            <igRibbon:XamRibbon.QuickAccessToolbar>
                                <igRibbon:QuickAccessToolbar>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:SeparatorTool Width="10"></igRibbon:SeparatorTool>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:SeparatorTool Width="10"></igRibbon:SeparatorTool>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                    <igRibbon:QatPlaceholderTool TargetId="MY_MENU_ITEM" TargetType="Tool"/>
                                </igRibbon:QuickAccessToolbar>
                            </igRibbon:XamRibbon.QuickAccessToolbar>
                            
                        </Ribbon:XamRibbon>
                    </Ribbon:RibbonWindowContentHost.Ribbon>
                </Ribbon:RibbonWindowContentHost>

While compiliing I get the error message as "Specified element is already the logical child of another element. Disconnect it first" and it is shown as an Unhandled Error.

The whole set of code, which starts from <Ribbon:XamRibbon is underlined and hovering the mouse over it gives me the tooltip as "Specified element is already the logical child of another element. Disconnect it first"

Please help....

Parents
No Data
Reply
  • 22015
    posted

    Hello BM,

     

    Thank you for your post!

     

    I have been looking into your issue. What I have noticed in the code snippet, that you have provided is that you have multiple ButtonTools with the same Id. Would you please provide each ButtonTool a unique Id.

     

    If the issue still persist after changing the Ids of the ButtonTools would you please provide me with more information about there where the style you have provided in your initial post is being assigned to the RibbonTabItem?

     

    Looking forward to hearing from you.

Children