views:

836

answers:

3

I have a FlowDocument in a standard WPF application window where I have some text, and in this text some hyperlinks and buttons.

The problem is, if I put this FlowDocument inside anything except a FlowDocumentPageViewer the hyperlinks and buttons are disabled ("grayed out").

<FlowDocumentScrollViewer>
  <FlowDocument>
      <Paragraph>
        Hello, World!
        <Hyperlink NavigateUri="some-uri">click me</Hyperlink>
        <Button Click="myButton_Click" Content="Click me too!" />
      </Paragraph>
  </FlowDocument>
</FlowDocumentScrollViewer>

The above will work and the link will be clickable. However, I don't want the full pageviewer thing since it will show navigation buttons (back/forward) zoom and it also has a weird column behavior.

I want it in a simple FlowDocumentScrollViewer (or anything else that just displays the text without additional fuzz).

EDIT: It's not only hyperlinks that is the problem. Any control, like Button, ListBox, ComboBox - anything that the user can interact with - is "grayed out" regardless of the IsEnabled properties if the FlowDocument is inside a FlowDocumentScrollViewer.

EDIT2: Alright, it must have been a mistake or something from my end, because I ended up rewriting the control and now it works. I guess there was some sort if IsEnabled=False somewhere in the visual tree that caused this.

A: 

I am wondering whether you expecing some thing like this?

<TextBlock>
<Hyperlink>
    <Run Text="Test link"/>
</Hyperlink >

</TextBlock>
Jobi Joy
I'd rather use FlowDocument since it gives me some additional formatting capabilities. (I'm using this for some simple online help for my app - just a dialog that briefly explains how to do a task)
Isak Savo
A: 

The issue is your Hyperlink isn't embedded in anything exposing a NavigationService I believe, hence they will show up grayed out.

sixlettervariables
+1  A: 

I'm using a FlowDocumentScrollViewer for my about box:

<FlowDocumentScrollViewer VerticalScrollBarVisibility="Auto">
    <FlowDocument>
        <Paragraph>
            <!-- ... -->

I don't have any of the controls or issues you mention.

David Schmitt