I have a ContentControl and its content is a custom FrameworkElement. FrameworkElement has only one child and it is a DrawingVisual. Basicly the ContentControl is a container for the DrawingVisual(which contains shapes) and ContentControl has the thumbs that the user use to drag, resize, rotate the control. ContentControl is added to a Canvas to display. I want to set clipping region of the ContentControl to a specific region in the Canvas. However wh开发者_StackOverflowen I set the Clip property of ContentControl to this region(RectangleGeometry specified in Canvas coordinate system) the DrawingVisual inside the ContentControl is clipped as if the given region is in the coordinate system of the ContentControl.
I can constrain the user to drag only inside this region but i don't want to do that. I want the user to be able drag outside and when a part of ContentControl is outside I don't want that part to be rendered. How can I do this?
create an intermediate contentcontrol in the canvas, position this to be where you want things to clip, set cliptobounds=true on it, put your existing contentcontrol inside of it.
精彩评论