【发布时间】:2017-11-19 00:51:47
【问题描述】:
我正在尝试按照here 的说明在标签下划线,但它不起作用。出现错误提示:
Mode must be specified for RelativeSource
但是我已经指出了:
<Label Grid.Row="0" Grid.Column="0" Tag="ID" FontWeight="Bold" Margin="10,5" HorizontalAlignment="Left">
<TextBlock TextDecorations="Underline" Text="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Label}}}" />
</Label>
这里有什么问题?
【问题讨论】:
-
这对我有用。尝试重建所有。为什么不直接使用TextBlock?似乎不需要标签。
标签: wpf xaml visual-studio-2008 label .net-3.5