Styling a Hyperlink???

I am using a Hyperlink element that contains a TextBlock control such as...

<Hyperlink>
    <TextBlock />
</Hyperlink>

What I need is to be able to style the rollOver state and have it underline all the text in the TextBlock, even if the text wraps. Currently it places a line beneath the entire text and not the all of the individual lines. See the photo below...

http://thewpfblog.com/images/hyperlink.gif

Any ideas
Lee


Answer this question

Styling a Hyperlink???

  • joekung

    Yes that works to underline the text but it doesn't have the rollOver color change.


  • aybe

    <Paragraph>
    <Figure Width="100" >
    <Paragraph>
    <Hyperlink>
    What I need is to be able to style the rollOver state and have it underline all the
    </Hyperlink>
    </Paragraph>
    </Figure>
    </Paragraph>

  • tyler2424

    This doesn't work either. Where am I supposed to put this code I put it in a FlowDocument but then rollover and click states don't work.


  • Andrew Fry

    Lee d: That works great except that it continues the underline to the end of the block of text. So if the last line of the hyperlink only goes halfway across, the underline keeps going till the end.

    Seems like this have to be a custom button. Thanks anyway,
    Lee


  • jccondor

    any flowdocument reader would work
  • William Vaughn

    how about

    <TextBlock>

    <Hyperlink>

    <TextBlock Width="100" TextWrapping="wrap">

    <Underline>What I need is to be able to style the rollOver state and have it underline all the</Underline>

    </TextBlock>

    </Hyperlink>

    </TextBlock>



  • Sumit_Dagar_8eba6d

    You could have something like this

    <TextBlock Width="100" TextWrapping="wrap"><Underline>text</Underline> </TextBlock>


  • Belgarion2

    Lee I started creating a style that triggered on IsMouseOver but then I realized that Inlines don't register that event. So close...I'm sure there is a way though.

  • ideal24293

    looks like this is working

    <FlowDocumentReader>

    <FlowDocument>

    <Paragraph>

    <Figure Width="100" >

    <Paragraph>

    <Hyperlink >

    What I need is to be able to style the rollOver state and have it underline all the

    </Hyperlink>

    </Paragraph>

    </Figure>

    </Paragraph>

    </FlowDocument>

    </FlowDocumentReader>



  • Styling a Hyperlink???