02-17-2016, 12:53 PM
Hi,
Is there a ways to know if a control is in or out of the current viewbox?
I made a test with a grid (inside the zoom panel) that contains 100 x 100 rectangles. I want to change the colors of the rectangles which are inside or outside of the viewbox. In my example the ViewBox.Contains(Point) method never returns true.
public void UpdateViewbox(Ab2d.Controls.ZoomPanel panel)
{
foreach (Rectangle item in MyGrid.Children)
{
Point point = item.TranslatePoint(new Point(0,0), this);
if (panel.Viewbox.Contains(point))
{
item.Fill = Brushes.Red;
}
else
{
item.Fill = Brushes.Blue;
}
}
}
Is there an example of how to do that?
Is there a ways to know if a control is in or out of the current viewbox?
I made a test with a grid (inside the zoom panel) that contains 100 x 100 rectangles. I want to change the colors of the rectangles which are inside or outside of the viewbox. In my example the ViewBox.Contains(Point) method never returns true.
public void UpdateViewbox(Ab2d.Controls.ZoomPanel panel)
{
foreach (Rectangle item in MyGrid.Children)
{
Point point = item.TranslatePoint(new Point(0,0), this);
if (panel.Viewbox.Contains(point))
{
item.Fill = Brushes.Red;
}
else
{
item.Fill = Brushes.Blue;
}
}
}
Is there an example of how to do that?