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
655
ContentPane grows when Region View is Injected
posted

I seem to have a weird issue that happens when PRISM V4 injects a view into a a ContentPane that before that only had the placeholder ContentControl that had nothing in it. When the view is injected if the view is bigger then the current size of the ContentPane it expands.

Is there a way to prevent his? I added a scrollviewer around the ContentControl where the views are injected so there is no reason why the user cannot use the pane in the smaller size or expand it if they wish.

The other thing i noticed though - If I resize the ContentPane and then inject the view it does NOT auto re-size to be bigger, which is what i want to happen always. Suggestions welcomed :)

  • 54937
    Verified Answer
    Offline posted

    Just as with many WPF elements, the size with which something is displayed is based upon its desired size which in turn is based upon the content. So ContentPane instances within a root SplitPane (i.e. those directly within the xamDockManager's Panes) that don't explicitly have their Width set (for splitpanes docked left/right) or their Height (for splitpanes docked top/bottom), then their size is determine based on the size returned when the elements are measured with the constraint provided to the contentpane. When you resize a splitpane you are explicitly setting the Width or Height of that splitpane. So if you don't want the SplitPane to resize then you would set the Width for root splitpanes docked to the left/right or the Height for root splitpanes docked to the top/bottom.