none
Nesting an accordion with VerticalAlignment="Stretch" hides content

    Question

  • I've been struggeling with this one and I think it's a bug in the Accordion control, but before reporting it on CodePlex I would like to know what you all think. Here is some XAML:

    <UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
                 xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit" 
                 x:Class="NestedAccordions.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
        <Grid x:Name="LayoutRoot">
            <layoutToolkit:Accordion Height="250" Width="125">
                <layoutToolkit:AccordionItem>
                    <layoutToolkit:Accordion VerticalAlignment="Stretch">
                        <layoutToolkit:AccordionItem>
                            <data:DataGrid x:Name="dataGrid"></data:DataGrid>
                        </layoutToolkit:AccordionItem>
                    </layoutToolkit:Accordion>
                </layoutToolkit:AccordionItem>
            </layoutToolkit:Accordion>
        </Grid>
    </UserControl>

    As you can see I've nested two Accordion controls. In the inner Accordion there is a DataGrid which is loaded with some records in code behind. As it is now, it will not show the datagrid (not even the column header). If I remove the VerticalAlignment="Stretch" it will then show the DataGrid, but it will not stretch the height of the Accordion to match it's parent (the AccordionItem of the outer Accordion control).

    I've tried wrapping the inner Accordion in other controls, like the StackPanel and the Grid and then mess around with the VerticalAlignment properties of those, but all end up hiding the DataGrid.

    I've also build a user control to see if there might be a problem with the DataGrid. I had an override for MeasureOverride and debugged to see what would happen, but the measure of the DataGrid works as expected (it claims enough Height to display its content). I've tried with other content, like a StackPanel with TextBlocks and they also get hidden by the Accordion.

    Has anyone seen this behavior? Does anyone know about a work around for this? Do you also feel this is a bug?

    I'll be thankful for any feedback you can give me.

    Friday, September 25, 2009 3:47 AM

Answers

  •  This issue was posted at codeplex as id 4128. You can find it here.

    If you have encountered this issue, please take a minute to vote for it.

    Tuesday, September 29, 2009 2:28 AM

All replies

  • Hi,

    I can reproduce this issue, I would suggest you reporting issue at Toolkit Issue Tracker, then post the link here, anyone encountered the same problem may find this thread and vote for you.

    Thanks,

    Tuesday, September 29, 2009 1:06 AM
  •  This issue was posted at codeplex as id 4128. You can find it here.

    If you have encountered this issue, please take a minute to vote for it.

    Tuesday, September 29, 2009 2:28 AM
  • hello


    is there any fix available to solve this problem

    or does anybody find a other way to implement nested accordions ?


    thanks for any help

    Monday, September 20, 2010 10:26 AM