とても簡単な質問です。スクロールビュー内に多数のスタックパネルがあります。ユーザーに(スクロールを介して)表示されているときにイベントを発生させたい。
前もって感謝します。
とても簡単な質問です。スクロールビュー内に多数のスタックパネルがあります。ユーザーに(スクロールを介して)表示されているときにイベントを発生させたい。
前もって感謝します。
このページをチェックしてください。要素が ScrollViewers ビューポートにあるかどうかを判断する方法を示します。
// position of your visual inside the scrollviewer
GeneralTransform childTransform = ContainedObject.TransformToAncestor(ScrollViewerObj);
Rect rectangle = childTransform.TransformBounds(new Rect(new Point(0,0),ContainedObject.RenderSize));
//Check if the elements Rect intersects with that of the scrollviewer's
Rect result = Rect.Intersect(new Rect(new Point(0, 0), ScrollViewerObj.RenderSize),rectangle);
//if result is Empty then the element is not in view
if (result == Rect.Empty)
{
//....
}
else
{
//obj is partially Or completely visible
//skip or bring obj in view.
}