This question is locked. New answers and comments are not allowed.
I have a TabControl with an ItemTemplate and the tabs content is defined in a ContentTemplate. Basically each tab contains a couple of RichTextBoxes (standard MS). See screenshot #1. This works fine; I can databind an arbitrary number of tabs and switch between them. But when there is a hyperlink/URL in the XAML of the RichTextBox the application throws an exception when I switch to or from this tab (never on first load). From attached screenshot #2 it seems that the TabControl is at fault, but I'm not sure. I'm unable to provoke this behaviour if there is no hyperlink in the XAML.
The TabControl is defined as such:
TabControlItemTemplate:
TabControlContentTemplate:
The TabControl is defined as such:
<
telerik:RadTabControl
x:Name
=
"RadTabControl2"
IsContentPreserved
=
"True"
ItemTemplate
=
"{StaticResource TabControlItemTemplate}"
ContentTemplate
=
"{StaticResource TabControlContentTemplate}"
SelectionChanged
=
"RadTabControl1_SelectionChanged"
OverflowMode
=
"Wrap"
/>
TabControlItemTemplate:
<
DataTemplate
x:Key
=
"TabControlItemTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
ToolTipService.ToolTip
=
"{Binding dimensions_tab.description}"
MinHeight
=
"21"
>
<
StackPanel
Orientation
=
"Horizontal"
VerticalAlignment
=
"Center"
>
<
Image
Source
=
"{Binding Converter={StaticResource TabIconConverter}, Path=ItemState}"
Stretch
=
"Fill"
Width
=
"18"
Height
=
"18"
/>
<
TextBlock
Text
=
"{Binding dimensions_tab.name}"
Margin
=
"3,0,8,0"
TextWrapping
=
"Wrap"
TextAlignment
=
"Left"
/>
</
StackPanel
>
<
telerik:RadButton
Visibility
=
"{Binding ItemVisibility}"
Click
=
"ButtonDelete_Click"
MouseEnter
=
"RadButton_MouseEnter"
MouseLeave
=
"RadButton_MouseLeave"
BorderBrush
=
"{x:Null}"
Background
=
"{x:Null}"
IsTabStop
=
"False"
VerticalAlignment
=
"Center"
ToolTipService.ToolTip
=
"{Binding LocStr.Delete_item, Source={StaticResource LocStr}}"
>
<
telerik:RadButton.Content
>
<
Image
x:Name
=
"CloseImage"
VerticalAlignment
=
"Center"
Width
=
"14"
Height
=
"14"
Stretch
=
"Fill"
Source
=
"close_tab_inactive.png"
/>
</
telerik:RadButton.Content
>
</
telerik:RadButton
>
</
StackPanel
>
</
DataTemplate
>
TabControlContentTemplate:
<
DataTemplate
x:Key
=
"TabControlContentTemplate"
>
<
ScrollViewer
VerticalScrollBarVisibility
=
"Auto"
BorderThickness
=
"0"
>
<
Grid
Margin
=
"6,4,6,4"
>
<
Grid
Visibility
=
"{Binding ItemState, Converter={StaticResource AddTabVisibleConverter}, ConverterParameter=BoundTab}"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
StackPanel
Orientation
=
"Vertical"
>
<
Grid
>
<
TextBlock
Text
=
"{Binding LocStr.Question, Source={StaticResource LocStr}}"
HorizontalAlignment
=
"Left"
Style
=
"{StaticResource TextBlockNormal}"
/>
<
HyperlinkButton
Click
=
"ButtonEditQuestion_Click"
Content
=
"{Binding LocStr.Edit, Source={StaticResource LocStr}}"
HorizontalAlignment
=
"Right"
Foreground
=
"Blue"
IsTabStop
=
"False"
Tag
=
"{Binding ElementName=RTBQuestion}"
/>
</
Grid
>
<
RichTextBox
x:Name
=
"RTBQuestion"
Loaded
=
"RTBQuestion_Loaded"
IsReadOnly
=
"True"
IsTabStop
=
"False"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Vertical"
Grid.Row
=
"1"
Margin
=
"0,5,0,0"
>
<
Grid
>
<
TextBlock
Text
=
"{Binding LocStr.Guidance, Source={StaticResource LocStr}}"
HorizontalAlignment
=
"Left"
Style
=
"{StaticResource TextBlockNormal}"
/>
<
HyperlinkButton
Click
=
"ButtonEditGuidance_Click"
Content
=
"{Binding LocStr.Edit, Source={StaticResource LocStr}}"
HorizontalAlignment
=
"Right"
Foreground
=
"Blue"
IsTabStop
=
"False"
Tag
=
"{Binding ElementName=RTBGuidance}"
/>
</
Grid
>
<
RichTextBox
x:Name
=
"RTBGuidance"
Loaded
=
"RTBGuidance_Loaded"
IsReadOnly
=
"True"
IsTabStop
=
"False"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Vertical"
Grid.Row
=
"2"
Margin
=
"0,5,0,0"
>
<
local:document_explorer
x:Name
=
"DocumentList"
Loaded
=
"DocumentList_Loaded"
></
local:document_explorer
>
</
StackPanel
>
</
Grid
>
<
Grid
Visibility
=
"{Binding ItemState, Converter={StaticResource AddTabVisibleConverter}, ConverterParameter=AddTab}"
Loaded
=
"UpdateAddTab"
>
<
TextBlock
x:Name
=
"TextIndicator"
Text
=
"{Binding LocStr.Question_add_indicator, Source={StaticResource LocStr}}"
Style
=
"{StaticResource TextBlockNormal}"
Visibility
=
"Collapsed"
/>
<
StackPanel
x:Name
=
"StackDimension"
Orientation
=
"Vertical"
>
<
TextBlock
Text
=
"{Binding LocStr.Question_add_dimension, Source={StaticResource LocStr}}"
Style
=
"{StaticResource TextBlockNormal}"
/>
<
ItemsControl
x:Name
=
"ItemsControlDimension"
>
<
ItemsControl.ItemsPanel
>
<
ItemsPanelTemplate
>
<
StackPanel
Orientation
=
"Vertical"
/>
</
ItemsPanelTemplate
>
</
ItemsControl.ItemsPanel
>
<
ItemsControl.ItemTemplate
>
<
DataTemplate
>
<
telerik:RadButton
Click
=
"RadButton_Click"
IsTabStop
=
"False"
HorizontalContentAlignment
=
"Left"
Margin
=
"0,2,0,0"
ToolTipService.ToolTip
=
"{Binding description}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"/IntRisk2;Component/Images/bd_dimensions.png"
Stretch
=
"Fill"
Width
=
"18"
Height
=
"18"
Margin
=
"5,0,3,0"
/>
<
TextBlock
Text
=
"{Binding name}"
/>
</
StackPanel
>
</
telerik:RadButton
>
</
DataTemplate
>
</
ItemsControl.ItemTemplate
>
</
ItemsControl
>
</
StackPanel
>
</
Grid
>
</
Grid
>
</
ScrollViewer
>
</
DataTemplate
>