This question is locked. New answers and comments are not allowed.
Hi,
I have a problem with binding custom ContentControl, in this case ViewContent (see code snippets), in RadTabControl.ContentTemplate. An exception occured when selecting tab item that has already been selected before. For example, there are 3 tab items (A,B,C), Firstly I select A and no error occurred, then I select B also no error occurred, but when I select A again, an exception occured stating "Element is already the child of another element.".
I knew the exception triggered because the ViewContent which has been selected before has already had a parent, so I just created a converter to remove the parent if a ViewContent has already had a parent. But the problem is, in the previous version of the project which this codes is used had no problem like this, and we haven't changed anything related to this code. I have no idea why the error appeared all of a sudden.
Is the problem related to RadTabControl? how can I fix the problem without doing workaround like this? Thanks.
Cheers,
I have a problem with binding custom ContentControl, in this case ViewContent (see code snippets), in RadTabControl.ContentTemplate. An exception occured when selecting tab item that has already been selected before. For example, there are 3 tab items (A,B,C), Firstly I select A and no error occurred, then I select B also no error occurred, but when I select A again, an exception occured stating "Element is already the child of another element.".
<
telerik:RadTabControl
x:Name
=
"tabControlMatterDetails"
SelectedItem
=
"{Binding SelectedItem, Mode=TwoWay}"
SelectedIndex
=
"0"
ItemsSource
=
"{Binding Service.Result}"
DropDownDisplayMode
=
"Visible"
ScrollMode
=
"Viewport"
>
<
telerik:RadTabControl.ItemTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Title}"
ToolTipService.ToolTip
=
"{Binding Description}"
/>
</
DataTemplate
>
</
telerik:RadTabControl.ItemTemplate
>
<
telerik:RadTabControl.ContentTemplate
>
<
DataTemplate
>
<
StackPanel
Margin
=
"20,10"
>
<
TextBlock
Style
=
"{StaticResource TitleText}"
Text
=
"{Binding Description}"
/>
<
ContentControl
VerticalContentAlignment
=
"Stretch"
HorizontalContentAlignment
=
"Stretch"
Content
=
"{Binding ViewContent}"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadTabControl.ContentTemplate
>
</
telerik:RadTabControl
>
I knew the exception triggered because the ViewContent which has been selected before has already had a parent, so I just created a converter to remove the parent if a ViewContent has already had a parent. But the problem is, in the previous version of the project which this codes is used had no problem like this, and we haven't changed anything related to this code. I have no idea why the error appeared all of a sudden.
Is the problem related to RadTabControl? how can I fix the problem without doing workaround like this? Thanks.
Cheers,