Sam Andy

I have a child which will draw its parent using VisualBrush as below

VisualBrush brush = new VisualBrush(_parent);

brush.ViewboxUnits = BrushMappingMode.Absolute;

Rect view = new Rect(rect.Left, rect.Top, rect.Width / 2, rect.Height / 2);

brush.Viewbox = view;

drawingContext.DrawRectangle(brush, new Pen(Brushes.Yellow, 4), rect);

but I never get it drawn alhough the brush is not null.

whats the problem here


Re: Windows Presentation Foundation (WPF) VisualBrush Issue

Kyle Neath

Well... you're trying to draw the parent. Which contains the child, which is trying to draw the parent, which contains the child, which is trying to draw the parent...

I'm not sure what you're trying to do here You've got a hallway of infinite mirrors going on from what I understand.




Re: Windows Presentation Foundation (WPF) VisualBrush Issue

Khalid Jayoussi

I am trying to do a magnifyglass. when the Rectangle move over its parent it will zoom its area.

I have a child control and this child will magnify its parent. so how can I do this

Thanks





Re: Windows Presentation Foundation (WPF) VisualBrush Issue

Zhou Yong

MSDN has a sample on how to create screen magnifier using VisualBrush.

Sheva





Re: Windows Presentation Foundation (WPF) VisualBrush Issue

Sam Andy

yes. I already saw this sample. but the magnfier is not a child for the parent window.

the sample contains 1 grid and this grid contains stackpanel and the Magnifier. the magnifier source is the stack panel not hte grid.

Thanks,