Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf GridViewColumn.CellTemplate中的超链接问题_Wpf_Xaml - Fatal编程技术网

Wpf GridViewColumn.CellTemplate中的超链接问题

Wpf GridViewColumn.CellTemplate中的超链接问题,wpf,xaml,Wpf,Xaml,如何在GridViewColumn.CellTemplate中调整WPF超链接 特别感谢@H.B. 这是解决办法 <GridViewColumn Width="Auto" Header="URL" > <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Name="ur

如何在GridViewColumn.CellTemplate中调整WPF超链接


特别感谢@H.B.

这是解决办法

<GridViewColumn   Width="Auto" Header="URL" >
    <GridViewColumn.CellTemplate>
        <DataTemplate>                                   
            <TextBlock  Name="urlToContent" MinWidth="100" Width="Auto">
                <Hyperlink NavigateUri="{Binding Path=URL}" Name="hlkURL"   RequestNavigate="OpenPageRequestNavigate">
                     <TextBlock Text="{Binding Path=URL}"/>  
                </Hyperlink>
             </TextBlock>
         </DataTemplate>
    </GridViewColumn.CellTemplate> </GridViewColumn


textbox
不支持,请使用
TextBlock

,因为@H.B.说您必须使用TextBlock


但是,您可以使用RichTextBox

嗯,您仍然应该在
超链接中使用
运行
而不是
文本块
。@H.B.啊!我懂了。你能解释一下为什么它更好吗?我猜Run没有那么重,对吗?是的,使用
TextBlock
也会自动创建
InlineUIContainer
,因为超链接的内容是内联线(流内容),而不是UI元素,
TextBlock
和其他控件“不应该存在”。