如何在文本块中的文本之间插入一个超链接? [英] How to insert one hyperlink between the text in a textblock?

查看:82
本文介绍了如何在文本块中的文本之间插入一个超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个文字说: 当他访问 this_is_Link   Place时,他非常高兴。 


所以,我有一个嵌入< TextBlock>中的链接使用类似这样的东西:

< Span xml:space =" preserve">< Run> Open< / Run>< Hyperlink NavigateUri =" ; HTTP://www.bing.com">秉< /超链接和GT;<润GT;在您的浏览器中。< / Run>< / span> 

在这种情况下,超链接具有我可以更改的前景色。但是,没有办法改变超链接的悬停状态。我已经看了很多关于SO的帖子说我们应该使用超链接按钮代替。但是,我的整个文本不是
在一行中查找。我使用堆栈面板三个文本块(当他访问时,这是链接,地点,他非常高兴。)但它不是一条线而且会破碎。


你能不能请在这里给我一些意见? 


谢谢。


解决方案

Adob​​e Systems Incorporated


< span style ="font-size:10.5pt; font-family:'Segoe UI',sans-serif;颜色:#454545"> Hyperlink 没有
样式。它显示在"超链接和主题/风格行为"部分。
似乎无法更改
悬停  超链接的颜色,除非您更改系统ThemeResource的SystemControlHyperlinkBaseMediumBrush属性值。而且我不建议你做那个


如果您需要更改悬停颜色,请使用< HyperlinkBut​​ton>相反,改变它的风格。


如上所述,如果您使用< HyperlinkBut​​ton>,整个文本不会在一行中查找。 


我的建议是使用
保证金来调整< HyperlinkBut​​ton>的位置


我做了一个简单的演示:



<网格背景=& "{ThemeResource ApplicationPageBackgroundThemeBrush}" > 

<! - < TextBlock TextWrapping =" WrapWholeWords">
< Span xml:space =" preserve">
<运行>打开< /运行>< Hyperlink NavigateUri =" http://www.bing.com"> Bing< / Hyperlink><运行>在您的浏览器中。< / Run>
< / span>
< / TextBlock> - >
< StackPanel Grid.Row =" 0"取向= QUOT;水平">
< TextBlock Height =" 45"字号= QUOT; 30英寸; Text ="open" TextAlignment = QUOT;中心">< / TextBlock的>
< HyperlinkBut​​ton Height =" 65"含量="秉"字号= QUOT; 30英寸; NavigateUri = QUOT; HTTP://www.bing.com"余量= << 5,-4.5,-3,0" />
< TextBlock Height =" 45"字号= QUOT; 30英寸;文本= QUOT;在您的浏览器中。">< / TextBlock>
< / StackPanel>

< / Grid>





看起来像这个:





最好的问候,


罗伊


Hi,

I have a text say:  When he visits this_is_Link Place, he was very happy. 

So, I have a link embedded in the <TextBlock> using something like this:

    <Span xml:space="preserve"><Run>Open </Run><Hyperlink NavigateUri="http://www.bing.com">Bing</Hyperlink><Run> in your browser.</Run></Span>

In this case, hyperlink has a foreground color which I can change. But, there is no way to change the hover state of the hyperlink. I have looked at many threads on SO saying that we should use hyperlink button instead. But, in that my whole text is not looking in one line. I used stack panel for three text blocks (when he visits, this is link, place, he was very happy.) but it was not in a line and coming broken.

Can you please give me some inputs here? 

Thanks.

解决方案

Hi Adobe Systems Incorporated

Hyperlink doesn’t have styles. It shows in the part of "Hyperlink and theme/style behavior". It seems not possible to change the hover color of the hyperlink unless you change the SystemControlHyperlinkBaseMediumBrush property value of system ThemeResource. And I don’t suggest you to do that.

If you need the change the hover color, please use <HyperlinkButton> instead and change its style.

As you said above, if you use the <HyperlinkButton>, the whole text is not looking in one line. 

My suggestion is that use the Margin to adjust the position of the <HyperlinkButton>

I made a simple demo:

 <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" >

        <!--<TextBlock TextWrapping="WrapWholeWords">
       <Span xml:space="preserve">
           <Run>Open </Run><Hyperlink NavigateUri="http://www.bing.com">Bing</Hyperlink><Run> in your browser.</Run>
       </Span>
        </TextBlock>-->
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <TextBlock Height="45" FontSize="30" Text="open " TextAlignment="Center"></TextBlock>
            <HyperlinkButton Height="65" Content="Bing" FontSize="30" NavigateUri="http://www.bing.com" Margin="5,-4.5,-3,0"/>
            <TextBlock Height="45" FontSize="30" Text=" Bn your browser."></TextBlock>
        </StackPanel>
        
    </Grid>


It looks like this:

Best regards,

Roy


这篇关于如何在文本块中的文本之间插入一个超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆