<igDock:XamDockManager> <igDock:XamDockManager.Panes> <igDock:SplitPane> <igDock:ContentPane> <StackPanel Height="300"> <Button>MyButton</Button> <igData:XamDataPresenter>
I have a situation similar to the above where I have a Button and a XamDataPresenter together on a dockable pane. However, with this arrangement, if the records displayed in the XamDataPresenter are more than the height of the pane, no vertical scroll bar appears on the right of the XamDataPresenter. I figured to use a Grid instead of a StackPanel to fix this from here: http://karlshifflett.wordpress.com/category/uncategorized/
But this presents a couple of problems. 1) The Button disappears, and 2) if I undock the pane and make it vertically bigger, the XamDataPresenter doesn't stretch to fill the size of the pane. If I remove the Height attribute from the Grid, its height becomes as big as required to display all records and the pane matches that size even when initially docked, thus resulting in the pane exceeding the size of the browser window and/or screen.
Is it possible to use a StackPanel without the vertical scroll bar disappearing? And in either case, how can I ensure the XamDataPresenter always stretches to the size of the pane but setting the pane to a maximum initial size (so it doesn't stretch to an excessive size just to match the XamDataPresenter displaying all records)?
Many thanks,Jason
Ah, replacing nearly all my StackPanels with DockPanels seems to have resolved all my sizing problems. I am even able to remove most of my MinWidth and MinHeight attributes and have no need for MaxWidth or MaxHeight attributes anywhere. My panes now all resize proportionately as the browser window size is changed and the outer panes stretch to the edge of the browser window on all sides.
Thanks for all your help!
XtreemX said: Also, the link to the zip file on the thread you linked to isn't clickable, so not sure what's happening there...?
Also, the link to the zip file on the thread you linked to isn't clickable, so not sure what's happening there...?
XtreemX said:How can I get rid of this effect without losing the ability to have my three panes arranged as shown in the screenshot?
I missed this question on the reply. It sounds like you want the panes to fill the available area but that is not currently an option. The xamDockManager is a ContentControl and its Content property is used to host an element that will fill the available area. It is not possible to have content panes fill the area other than to use a DocumentContentHost to provide VS style tabbed document behavior.
XtreemX said:Thanks Andrew. I've took from this that StackPanels are not ideal for containing controls where the orientation dimension can vary significantly
Actually stackpanels are primarily used for list type controls where the content will be scrolling (i.e. this is normally the panel used for the ItemsPanel of an ItemsControl like a ListBox or MenuItem). They are not used when you want something to "fill" an available area. For filling an area, you normally use a DockPanel or Grid. Let me put it another way. If you put a rich textbox with 10000 lines of text in a vertically oriented stackpanel then the rich textbox will be as tall as would be need to see all 10000 at once (i.e. you will not scroll the rich textbox).
XtreemX said:Firstly, the pane showing the 'Contact Details' (ContentPane cpContact in the XAML) has a height that extends beyond the bottom of the browser window
Thanks Andrew. I've took from this that StackPanels are not ideal for containing controls where the orientation dimension can vary significantly.
Well, I've had a tinker with my layout and I think the best way to explain what's going on is to put a stripped down version of my XAML here and explain where I'm having the problem.
This is the XAML:
<Page ...> <StackPanel> <TextBlock>Some Text</TextBlock> <igDock:XamDockManager> <igDock:XamDockManager.Panes> <igDock:SplitPane> <igDock:ContentPane MinWidth="300" MinHeight="600"> <!-- Some controls here --> </igDock:ContentPane> </igDock:SplitPane> <igDock:SplitPane> <igDock:ContentPane Name="cpMain" MinWidth="600"> <igDock:XamDockManager MinHeight="500"> <igDock:XamDockManager.Panes> <igDock:SplitPane Name="spData" SplitterOrientation="Vertical" igDock:XamDockManager.InitialLocation="DockedTop"> <igDock:ContentPane> <!-- Some controls here --> </igDock:ContentPane> <igDock:ContentPane> <!-- Some controls here --> </igDock:ContentPane> </igDock:SplitPane> <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedBottom"> <igDock:ContentPane Name="cpContact"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="22.0" /> </Grid.RowDefinitions> <igData:XamDataPresenter Grid.Row="0" Name="myData" DataSource="{Binding}" />
<Button Grid.Row="1" Name="btnToggleView" Click="btnToggleView_Click">Toggle View</Button> </Grid> </igDock:ContentPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> </igDock:XamDockManager> </igDock:ContentPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> </igDock:XamDockManager> </StackPanel></Page>
And this is the screenshot below of what it produces (the unstripped version):
Firstly, the pane showing the 'Contact Details' (ContentPane cpContact in the XAML) has a height that extends beyond the bottom of the browser window due to the XamDataPresenter within it stretching to display all records. I specified the height of the grid row to which it is assigned to be * so that it takes up only the available space, but this seems to have had no effect. Ideally, I just want this cpContact pane to stretch to the bottom of the browser window and no further.
Also, I'd like the cpMain pane to stretch to the entire width of the browser window and all ContentPanes within it to stretch to fill cpMain's width.
Secondly, the splitter between the SplitPane containing cpContact and the SplitPane above (spData) seems to have a two-fold effect. If clicked and dragged, it makes the pane dragged into smaller, but the pane dragged away from remains the same size and an open gap is left in between. How can I get rid of this effect without losing the ability to have my three panes arranged as shown in the screenshot? I've also noticed that unpinning the cpContact ContentPane results in a large gap in its place rather than the above SplitPane stretching to fill the new space.
Hopefully, you'll look at this and quickly see I'm doing it all wrong and give me the quick easy magic solution that I should be using. Either way, hope you can help, and thanks for all your help so far.
Jason