locked
Toolkit:Accordion control, I have a treeview inside it, RRS feed

  • Question

  • In my According Control, I have different treeviews. I want the treeview to be IsExpanded=false from the beginning.

    When I exand nodes in my treeview the area isn't big enough to display the whole tree. If I then collapse the according control and opens it again, everything is visible.

    The strange thing is that it works when clicking on some of the nodes but not on others. Is something wrong with my code or is ther a bug in any of the controls?

    <Border BorderBrush="Black" BorderThickness="0,0,0,0" HorizontalAlignment="Left" Margin="8,56,0,17" Width="280">
       <toolkit:Accordion HorizontalAlignment="Left" Width="271" Height="Auto" Margin="8,0,0,0" BorderThickness="2" BorderBrush="#FF7C7575" SelectionMode="ZeroOrMore" FontFamily="Fonts/BuxtonSketch.ttf#Buxton Sketch" FontSize="12">
        <toolkit:AccordionItem Header="System Configuration" FontFamily="Fonts/BuxtonSketch.ttf#Buxton Sketch">
          <toolkit:AccordionItem.Content>
           <StackPanel Orientation="Vertical">
           <sdk:TreeView BorderThickness="0" HorizontalAlignment="Left">
            <sdk:TreeViewItem Header="Interestrates"></sdk:TreeViewItem> 
           <sdk:TreeViewItem Header="Listitems configurable">
            <sdk:TreeViewItem Header="Itemtype 1"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Itemtype 2"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Itemtype 3"></sdk:TreeViewItem> 
           </sdk:TreeViewItem> 
           <sdk:TreeViewItem Header="Listitems non-configurable">
            <sdk:TreeViewItem Header="Itemtype 1"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Itemtype 2"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Itemtype 3"></sdk:TreeViewItem> 
           </sdk:TreeViewItem> 
          </sdk:TreeView>
          
          <sdk:TreeView BorderThickness="0" HorizontalAlignment="Left">
           <sdk:TreeViewItem Header="Credit products">
            <sdk:TreeViewItem Header="Product 1"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Product 2"></sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Product 3"></sdk:TreeViewItem> 
           </sdk:TreeViewItem> 
          </sdk:TreeView>
          </StackPanel>
          </toolkit:AccordionItem.Content>
         </toolkit:AccordionItem>
         
         <toolkit:AccordionItem Header="Customer and Organization configuration">
           <toolkit:AccordionItem.Content>
            <StackPanel Orientation="Vertical">
             <sdk:TreeView BorderThickness="0" HorizontalAlignment="Left">   
             <sdk:TreeViewItem Header="Kund 1">
             <sdk:TreeViewItem Header="Lists"></sdk:TreeViewItem> 
             <sdk:TreeViewItem Header="Products"></sdk:TreeViewItem>   
            </sdk:TreeViewItem> 
            <sdk:TreeViewItem Header="Kund 2">
             <sdk:TreeViewItem Header="Lists">
              <sdk:TreeViewItem Header="Lista av typ 1"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Lista av typ 2"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Lista av typ 3"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Lista av typ 4"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Lista av typ 5"></sdk:TreeViewItem> 
             </sdk:TreeViewItem> 
            
             <sdk:TreeViewItem Header="Products">
              <sdk:TreeViewItem Header="Bottenlån"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Topplån"></sdk:TreeViewItem> 
              <sdk:TreeViewItem Header="Blancolån"></sdk:TreeViewItem> 
             </sdk:TreeViewItem> 
            
             <sdk:TreeViewItem Header="Organizations">      
              <sdk:TreeViewItem Header="Organization 1">
               <sdk:TreeViewItem Header="Lists"></sdk:TreeViewItem> 
               <sdk:TreeViewItem Header="Products"></sdk:TreeViewItem>      
             </sdk:TreeViewItem> 
            </sdk:TreeViewItem>
           </sdk:TreeViewItem> 
          </sdk:TreeView>
           <HyperlinkButton Content="New Customer" Style="{StaticResource HyperlinkButton-Sketch}" Canvas.ZIndex="1" FontSize="12" Margin="3,0,0,0"/>
          <HyperlinkButton Content="New Organization" Style="{StaticResource HyperlinkButton-Sketch}" Canvas.ZIndex="1" FontSize="12" Margin="3,0,0,3"/>
          </StackPanel>
          </toolkit:AccordionItem.Content>
         </toolkit:AccordionItem>
       </toolkit:Accordion>
      </Border>

     

     

    Monday, May 10, 2010 8:16 AM

All replies

  • it looks like your toolkit:Accordion is not handling the sizeToContent very well. If you put your stackpanel in a normal windows/grid, you can see the treeview is display fully inside the stack panel.


    Thanks, Harry Huang [MSFT]
    Thursday, May 13, 2010 5:01 AM