Autosize Expander Content with Scrollbar

Navigation for WPF Forum

Posted 11 years ago by Joseph Gershgorin
Avatar
If my row definitions look like this:

<Grid.RowDefinitions >
<RowDefinition Height="Auto" />
<RowDefinition Height="1" />
<RowDefinition Height="Auto" />
<RowDefinition Height="1" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

Then the expander content panes size out, but they go off the screen if the content is too high (long treeview). If I use star instead of auto sizing then scroll bars appear when the content is too high, but the height of the expanders is no longer dynamic.

I would like it so the height of the expanders size to content within its container (while still showing any expander headers/content that may be below or above the current expander) and still show scrollbars if the content is too high.

Is this possible?

Comments (5)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joseph,

Can you put together a tiny sample project that shows the full example of what you're trying to do and email that over? That would help make sure we understand your question correctly. Thanks!


Actipro Software Support

Posted 10 years ago by David Mullin
Avatar
I'm experiencing a similair issue. I've got a NavigationBar on my window like:

<navigation:NavigationBar Grid.Row="0" Grid.Column="0" IsMinimized="False" ArePanesVisible="False" PopupResizeMode="None">
    <navigation:NavigationPane Title="List">
        <ctConfigControls:SideListGrid x:Name="SideList" SelectedDataRowChanged="SideList_SelectionChanged" />
    </navigation:NavigationPane>
</navigation:NavigationBar>
The SideListGrid is an xceed DataGrid. If the number of items in the grid is small, then when I activate the popup (i.e., the bar is minimized and I click on it to get the popup), it works fine. However, if the list is very long (several times the height of the screen), then the app actually hangs (well, it might recover eventually, but I never wait that long).

It appears that the control is trying to determine the actual height of the grid and is failing there.

What I'd really like is for the popup to be no taller than the NavigationBar control itself and/or be able to disable the popup.

David Mullin
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
David,

Our code for the popup is pretty much all in XAML. It's just Borders with a ResizeableContentControl (which functions like a normal ContentControl but with a gripper) and a ContentPresenter. The ResizableContentControl even has a MaxHeight on it to keep it no larger than the NavBar height.

It sounds like perhaps the Xceed grid has the bug here if it can't handle a measurement/arrange request that is being passed. If you make a simple sample project showing it and email it over we can take a look but my guess based on what you said is that it's a bug on their end.


Actipro Software Support

Posted 10 years ago by David Mullin
Avatar
I'll see about putting together a simple repro.

In the meantime - is there any way to disable the popup?

Or, maybe I'm just going about this all wrong.

The NavigationBar was actually my second choice - my first was the Animated Expander. The issue was that I've got a GridSplitter to control the width of the collapsable region. When I used the Animated Expander, if I touched the GridSplitter, then the collapsable region didn't really collapse. When I replaced the Animated Expander with the NavigationBar, it all worked the way I wanted. Did I miss something on the expander?
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
NavigationBar has special code that we added to work well within Grids with a GridSplitter. That's why it works as you want.

When moving a grid splitter, it will actually force a certain size on the child controls. Thus an expander there will not resize to use less width when collapsed. You'd have to probably track the expander's state change event and then do some manual code on your grid to resize things.

Sorry but there isn't a way to turn off the NavigationBar minimized popup. You can prevent the NavigationBar from being minimizable however that would defeat the purpose of why you chose to use it in the first place. :)


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.