我真的找不到如何解决以下问题。我有:
<TextBlock Style="{StaticResource HoverBox}" HorizontalAlignment="Left" Margin="0,0,5,0" Name="lblAuthFullPath" VerticalAlignment="Top" Width="575" TextWrapping="Wrap" Padding="5,0,0,0"
MouseLeftButtonDown="lblAuthFullPath_MouseLeftButtonDown">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}{1}{2}">
<Binding Path="Text" ElementName="tbxAuthHost" />
<Binding Path="Text" ElementName="tbxAuthWebsiteName" />
<Binding Path="Text" ElementName="tbxWebServicesAuthentication" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
它运作正常。
我想在<Hyperlink>
...
<TextBlock>
我如何调整<MultiBinding>
为<Hyperlink>
而不是 <TextBlock>
做同样的事情?
有可能吗?
答案 0 :(得分:2)
Hyperlinks
可以包含Runs
,因此您可能希望将绑定应用于Text
Run
的{{1}}
答案 1 :(得分:-1)
超链接是跨度并包含内联,因此
<Hyperlink>
<TextBlock Style="{StaticResource HoverBox}" HorizontalAlignment="Left" Margin="0,0,5,0" Name="lblAuthFullPath" VerticalAlignment="Top" Width="575" TextWrapping="Wrap" Padding="5,0,0,0"
MouseLeftButtonDown="lblAuthFullPath_MouseLeftButtonDown">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}{1}{2}">
<Binding Path="Text" ElementName="tbxAuthHost" />
<Binding Path="Text" ElementName="tbxAuthWebsiteName" />
<Binding Path="Text" ElementName="tbxWebServicesAuthentication" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Hyperlink>
会奏效。