Results 1 to 2 of 2

Thread: Grid with different sized cells

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    127

    Grid with different sized cells

    Im curious if anyone knows any way to change the width and height of a specific cell in a grid in WPF? or any way to accomplish the same thing using a different control?? I basically want to be able to highlight just 1 cell, and expand that 1 cell to be wider and taller than the rest of the cells. Any help would be greatly appreciated. I post a really crappy sample of something similar to what i mean if that might help get my point across better. thanks alot

    http://img41.imageshack.us/img41/7403/91567559.png

  2. #2
    Member
    Join Date
    May 2007
    Posts
    40

    Re: Grid with different sized cells

    Could you maybe use nested grids with gridsplitters for that?
    In your 2x2 example that could work out to be something like:


    Code:
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*" />
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <TextBlock>Cell 1</TextBlock>
                </Grid>
                <GridSplitter  Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"></GridSplitter>
                <Grid Grid.Row="2">
                    <TextBlock>Cell 4</TextBlock>
                </Grid>
            </Grid>
            <GridSplitter Grid.Column="1"></GridSplitter>
            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <TextBlock>Cell 2</TextBlock>
                </Grid>
                <GridSplitter  Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"></GridSplitter>
                <Grid Grid.Row="2">
                    <TextBlock>Cell 3</TextBlock>
                </Grid>
            </Grid>
        </Grid>
    Don't know if that lets you resize your cell width in the way you want though...

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