Question

How can I go about creating a control that has items in item that list vertically, but only to the height of the control, then start at the top of the second column?

Sort of like the windows explorer look and feel.

I am using a WrapPanel at the moment, but I cannot figure out how to make it scroll horizontally...

Any help here is greatly appreciated

Cheers, Mark

Was it helpful?

Solution

Enclose a WrapPanel with vertical orientation within a ScrollViewer with VerticalScrollbarVisibility set to Disabled.

Paste this into Kaxaml and you'll see:

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Page.Resources>
    <Style TargetType="{x:Type Button}">
      <Style.Setters>
        <Setter Property="Width" Value="50"/>
        <Setter Property="Height" Value="50"/>
      </Style.Setters>
    </Style>
  </Page.Resources>
  <Grid Margin="200, 100">
    <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Visible" MaxWidth="200">
    <WrapPanel Orientation="Vertical">
      <Button/>
      <Button/>
      <Button/>
      <Button/>
      <Button/>
      <Button/>
      <Button/>
      <Button/>
      <Button/>
    </WrapPanel>
    </ScrollViewer>
  </Grid>
</Page>

OTHER TIPS

Sounds alot like a UniformGrid or a WrapPanel to me check this blog, he has some nice demos of the built-in layout panels

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top