【发布时间】:2009-06-02 00:02:35
【问题描述】:
以下 XAML 只是画布上缩放 x2000 的多边形。当鼠标悬停在多边形上时,有一个触发器会改变多边形的填充颜色。
当您将鼠标悬停在多边形的上方和左侧时,为什么框会改变颜色。
<Canvas Background="Black" Height="600" Width="600">
<Canvas.RenderTransform>
<ScaleTransform ScaleX="2000" ScaleY="2000" />
</Canvas.RenderTransform>
<Polygon>
<Polygon.Resources>
<Style TargetType="Polygon">
<Setter Property="Fill" Value="HotPink"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" Value="LimeGreen"/>
</Trigger>
</Style.Triggers>
</Style>
</Polygon.Resources>
<Polygon.Points>
<PointCollection>
<Point X="0.1" Y="0.1" />
<Point X="0.2" Y="0.1" />
<Point X="0.2" Y="0.2" />
<Point X="0.1" Y="0.2" />
</PointCollection>
</Polygon.Points>
</Polygon>
</Canvas>
如果我将 Polygon 替换为 TextBlock,则不会发生这种情况。我怎样才能避免这种情况发生?
【问题讨论】:
标签: wpf