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
1090
Hosting user controls in floating panes
posted

Hey,

I have a number of user controls in my system that I want to add in floating panes in the dock manager programatically.  I want the floating pane to host the user control with the size that it appears in the designer (ie if I designed the user control 300x300 I want the user control to start as 300x300 when it's first shown).  I also want to be able to resize the content pane and have the user control resize with the content pane.

I had a solution that sort of works for this:

1.) I create a dummy Border and set its height and width to the height and width of the user control
2.) I set the user control's height and with to NaN.
3.) I add both the dummy Border and the user control to a new Grid panel.
4.) I set the Grid panel as the content of a new content pane.
5.) I add the content pane to a split pane with its initial location set to floating only.
6.) I add the split pane to the dock manager.

This solution is sort of a hack so if there's a better way to host user controls then I would rather use it.

Here's my problem with the above solution:  if I have a XamDataGrid set to fill a user control and I bind data to that XamDataGrid, the floating pane resizes to show all of the rows in the xam data grid and all of the columns in the xam data grid.  I would prefer that the floating pane only resize if the user explicitly resizes it.

This may be relevent: if I resize the pane at all before binding data to the XamDataGrid, then the pane won't resize when the XamDataGrid is bound.

Any help with this would be greatly appreciated.


Thanks

Parents
No Data
Reply
  • 54937
    Verified Answer
    Offline posted

    If you haven't set the attached XamDockManager.FloatingSize on the root split pane that you are floating then the size of the floating window will be based on the size of the content. If you have an element like a XamDataGrid or ListBox with lots of data then they are going to return a large desired size. Maybe what you should try doing is to use the XamDockManager.SetFloatingSize on the split pane using the Width/Height of the UserControl and then clear the Width/Height of the UserControl.

Children