Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
Clipping of ContentPane by child control
posted

Hi,

I'm trying to set negative margins for control that is within a ContentPane to hide parts of the control. But when I do that the control moves over the ContentPane's Header. I've tried putting the control in a grid and setting 'ClipToBounds' but it still doesnt work. I cannot set the Clip property of the control because the contentpane can be floatable and resizeable and the clip cannot be resized accordingly.

 

I've noticed this happens only when the contentpane is docked. When it is floating it works well.

Any help in this is appreciated

  • 54937
    Offline posted

    Putting the element within the negative margins into an element that has ClipToBounds set to true should work unless of course the element with the negative margins is (or contains) an HwndHost (e.g. WindowsFormsHost, WebBrowser, Frame with url, AddInHost, etc.). In that case the only reason it would appear to work when floating is because when you have a single floating pane the header is provided by the non-client area of the Window and not by WPF elements in which case you wouldn't have the air space issues you would have with an HwndHost.