为什么VisualTreeHelper.GetDescendantBounds(SomeVisualItem)方法返回(-Infinity,-Infinity,Infinity,Infinity)
某些可视化项的Canvas.Left、Canvas.Top、Width ...都是显式分配的。
发布于 2012-03-06 17:28:32
我解决了。我只是在我的控件的ControlTemplate中删除了ViewBox的效果:
<Viewbox Opacity=".7" Stretch="Uniform" IsHitTestVisible="False" FocusVisualStyle="{x:Null}" IsEnabled="False" ForceCursor="False" x:Name="PART_OutThumb">
<Viewbox.Effect>
<BlurEffect KernelType="Gaussian" Radius="1" />
</Viewbox.Effect>
</Viewbox>至:
<Viewbox Opacity=".7" Stretch="Uniform" IsHitTestVisible="False" FocusVisualStyle="{x:Null}" IsEnabled="False" ForceCursor="False" x:Name="PART_OutThumb">
</Viewbox>现在VisualTreeHelper.GetDescendantBounds()运行得很好了!
https://stackoverflow.com/questions/9566714
复制相似问题