Hi, I'm trying to add scrollviewer inside the OutlookBarGroup. Here is my code:
#######################################################################
<igOB:OutlookBarGroup Header="test" IsSelected="True">
<StackPanel>
<Expander Name="testExpander" IsExpanded="True" HorizontalAlignment="Stretch" VerticalAlignment="Top" Background="#FFCEE3FF">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<TreeView Name="testTree">
<....many treeviewitem...>
</TreeView>
</ScrollViewer>
</Expander>
</StackPanel>
</igOB:OutlookBarGroup>
The scrollviewer doesn't show unless assigned height because the height of Expander is infinite. Then I tried binding scrollview's height to Expander's actualheight, but that won't work.
So I'm wondering how can I set the scrollviewer's height? Any suggestion will be appreciate!
Remove the StackPanel. It is not the Expander that is making the height infinite, it is the stackpanel. In this case you have a vertically arranged stackpanel and so the height of the elements in the stackpanel will be based on their desired height. BTW, the TreeView contains a ScrollViewer so I doubt you need a scrollviewer around it - actually it would mean you would be able to use virtualization in the treeview.
But there are more than one Expander inside the OutLookBarGroup. I have to put all expanders inside a StackPanel.
Then you cannot expect the scrollviewer within to be used since as I said a StackPanel will measure the child elements with infinity in the orientation being arranged. Maybe instead of a stackpanel you would use a Grid with a RowDefinition for each Expander so that each Expander gets an equal portion of the available space.
Yes, that works.
But please check out the attachment. I'm just wondering how does this works? It's a demo from xamOutlookBar->Interacting with the XamOutlookBar->Dynamically Modifying Groups.