views:

248

answers:

1

I want to make a FlowDocument that contains both user-specified content, and hyperlinks for manipulating that content. I want the user to be able to highlight the content with the mouse, and copy it to the clipboard. Is there any way to allow that, while preventing the user from highlighting and copying the hyperlinks?

(Note that the user won't edit this FlowDocument directly -- it's just a nice means of displaying content they've entered elsewhere.)

For example:

<FlowDocumentScrollViewer>
  <FlowDocument>
    <Paragraph>
      Blah blah blah blah, blah blah blah -- blah blah blah blah blah blah.
      Blah, blah blah Blah blah blah, blah blah blah blah-blah blah.
      (<Hyperlink>Edit</Hyperlink> - <Hyperlink>Delete</Hyperlink>
    </Paragraph>
  </FlowDocument>
</FlowDocumentScrollViewer>

The user can use the mouse to highlight the "Version 1.0" text, and copy it to the clipboard. This is good. However, they can also highlight the hyperlinks, and copy those. I'd rather avoid that, for two reasons:

  • The hyperlinks aren't really part of the content, so what good are they on the clipboard or in another program?
  • I also expect to have other hyperlinks on the form that aren't part of the FlowDocument, and it would be poor form for some hyperlinks to be highlightable and others not.

I like having these hyperlinks word-wrap with the paragraph, and always appear just to the right of the last line of wrapped text. As far as I know, that means they need to be part of the FlowDocument. But that's just an artifact of layout -- I'd be just as happy having them outside if I could get the same layout. I don't want the hyperlinks to be highlightable, any more than I would want a dialog's OK and Cancel buttons to be highlightable. Is there any way to make that happen?

A: 

I've just checked with Blend and you can't really apply property like IsSelectionEnabled=false to block

However you can put which don't get copied (maybe in word?) and can get skinned

The other option is to show the content in the Flow Document and have the edit and control elsewhere. If you do not want to play with the FlowDocumentScrollViewer you might be able to play with grid and position the button like it's part of the FlowDocumentScrollViewer

JC