在垂直StackPanel中悬停HyperlinkButton时,将HyperlinkButton英寸下方的控件向下移动几个像素。这是一个奇怪的错误,我确定有一个修复,但我发现唯一的HyperlinkButton错误修复与大文本呈现有点模糊悬停,而不是这个定位错误。有人遇到过这个吗?
XAML:
<Canvas x:Name="LayoutRoot">
...
<StackPanel x:Name="Article1" Style="{StaticResource ArticleContainer}"
Canvas.Top="46">
<StackPanel Orientation="Horizontal">
<Image x:Name="Article1Image" Style="{StaticResource ImageCategory}"/>
<TextBlock x:Name="Article1Title" Style="{StaticResource TitleText}"/>
</StackPanel>
<TextBlock x:Name="Article1Posted" Style="{StaticResource PostedText}"/>
<HyperlinkButton x:Name="Author1Link" Style="{StaticResource HLBStyling}">
<TextBlock x:Name="Article1By" Style="{StaticResource AuthorText}"/>
</HyperlinkButton>
<TextBlock x:Name="Article1Content" Style="{StaticResource ContentText}"/>
<HyperlinkButton x:Name="Article1Link" Style="{StaticResource HLBStyling}">
<TextBlock x:Name="Article1ReadMore" Style="{StaticResource ReadMoreText}"/>
</HyperlinkButton>
</StackPanel>
...
</Canvas>
的App.xaml:
<Style x:Key="ContentPanel" TargetType="Border">
<Setter Property="Height" Value="427"/>
<Setter Property="Width" Value="250"/>
<Setter Property="Canvas.Top" Value="33"/>
<Setter Property="Canvas.Left" Value="0"/>
<Setter Property="Canvas.ZIndex" Value="1"/>
</Style>
<Style x:Key="ArticleContainer" TargetType="StackPanel">
<Setter Property="Height" Value="195"/>
<Setter Property="Width" Value="230"/>
<Setter Property="Canvas.Left" Value="10"/>
<Setter Property="Canvas.ZIndex" Value="2"/>
</Style>
<Style x:Key="ImageCategory" TargetType="Image">
<Setter Property="Width" Value="40"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5,5,5,0"/>
</Style>
<Style x:Key="TitleText" TargetType="TextBlock">
<Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Width" Value="170"/>
<Setter Property="TextTrimming" Value="WordEllipsis"/>
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
<Style x:Key="PostedText" TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="14"/>
<Setter Property="Width" Value="230"/>
<Setter Property="Margin" Value="0,10,0,0"/>
</Style>
<Style x:Key="AuthorText" TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="14"/>
<Setter Property="Width" Value="230"/>
</Style>
<Style x:Key="ContentText" TargetType="TextBlock">
<Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="MaxHeight" Value="90"/>
<Setter Property="Width" Value="230"/>
<Setter Property="TextTrimming" Value="WordEllipsis"/>
</Style>
<Style x:Key="ReadMoreText" TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Height" Value="16"/>
</Style>
<Style x:Key="HLBStyling" TargetType="HyperlinkButton">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="IsTabStop" Value="False"/>
</Style>
答案 0 :(得分:0)
这是由您用于HyperLinkButton(HLBStyling)的两种样式及其包含的TextBlocks(AuthorText,ReadMoreText)引起的。 如果删除TextBlock并只设置HyperLinkButton的内容,则问题就会消失。此外,如果从按钮中的TextBlocks中删除样式,则问题就会消失。