Reputation: 15946
I'm trying to add RichTextBoxes into the cells of a DataGrid. The RichTextBox contains a Hyperlink, but when I click it, it throws the following exception:
'Invalid Operation Exception - Reference is not a valid visual DependencyObject'
Why is this happening?
Upvotes: 1
Views: 393
Reputation: 58
I would say don't use Hyperlink and use HyperlinkButton instead. Something like this:
var hyperLink = new InlineUIContainer
{
Child = new HyperlinkButton
{
NavigateUri = myUri,
TargetName = "_blank",
Content = myText
}
};
Upvotes: 1