Why does the VisualTreeHelper.GetDescendantBounds(SomeVisualItem)
method return (-Infinity,-Infinity,Infinity,Infinity)
?
The SomeVisualItem's Canvas.Left
, Canvas.Top
, Width
, ... are explicitly assigned.
Why does the VisualTreeHelper.GetDescendantBounds(SomeVisualItem)
method return (-Infinity,-Infinity,Infinity,Infinity)
?
The SomeVisualItem's Canvas.Left
, Canvas.Top
, Width
, ... are explicitly assigned.
I solved it. just i removed Effect from a ViewBox in my control's ControlTemplate:
<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>
To:
<Viewbox Opacity=".7" Stretch="Uniform" IsHitTestVisible="False" FocusVisualStyle="{x:Null}" IsEnabled="False" ForceCursor="False" x:Name="PART_OutThumb">
</Viewbox>
Now VisualTreeHelper.GetDescendantBounds()
works well!