CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    2

    ScrollBars for ListBox within Listbox

    Hello,

    I have an problem that I can not solve for quite some time.
    For simplicity, I have a sample code to demonstrate the idea...

    <Grid>
    <ListBox>
    <ListBoxItem>
    <Expander Header="OuteItem">
    <ListBox>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    </ListBox>
    </Expander>
    </ListBoxItem>
    <ListBoxItem>
    <Expander Header="OuteItem">
    <ListBox>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    </ListBox>
    </Expander>
    </ListBoxItem>
    <ListBoxItem>
    <Expander Header="OuteItem">
    <ListBox>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    </ListBox>
    </Expander>
    </ListBoxItem>
    <ListBoxItem>
    <Expander Header="OuteItem">
    <ListBox>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    <TextBlock>InnerItem</TextBlock>
    </ListBox>
    </Expander>
    </ListBoxItem>
    </ListBox>
    </Grid>


    The OuterItem listbox is scrollable and is just fine.
    Anyone has any idea how to make InnerItem ListBox scrollable???
    Thank you so much!

  2. #2
    Join Date
    Aug 2008
    Posts
    6

    Re: ScrollBars for ListBox within Listbox

    I think perhaps the inner items do not have a scrollbar because the inner ListBox is not limited in height and just continues to expand to accommodate each new item. If you were to restrict the height of each inner ListBox then a scrollbar would appear whenever the contents became too large to fit in the defined height.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured