Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Simple table layout

 
 
Old 11-07-2006   #1 (permalink)
Jan Kucera


 
 

Simple table layout

Hi again...

How can I layout the window something like
<table width=100% height=100%>
<tr>
<td width=25% />
<td />
</tr>
</table>

and make the controls in the cells like Dock=Fill?

Is it possible to make the column user-resizable without using WindowsForms
SplitContainer control?

Thanks,
Jan


My System SpecsSystem Spec
Old 11-09-2006   #2 (permalink)
Stoitcho Goutsev \(100\)


 
 

Re: Simple table layout

Jan,

That would be something like
<Grid>

<Grid.ColumnDefinitions>
<ColumnDefinition Width=".25*"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>

<Rectangle Grid.Column="0" Fill="Green"/>
<Rectangle Grid.Column="1" Fill="Red"/>

</Grid>

I added rectangles in the cells just to show the cell boundaries. Normally
controls will stretch to fill out all the available space (as the rectangles
do in the example), but if this is not the default behavior for a given
control you can set contro's HorizontalAlignment and VerticalAlignment to
*Stretch*

WPF provides control called GridSplitter, which purpose is to provide UI for
changing size of 2 adjacent columns or rows. There are couple of ways how to
add a splitter to a grid so I suggest reading in the docs for example a
splitter can be added to one of the columns or in a column by itself, it has
to be properly aligned and so on.
Here is an example with the previous grid, but it also have a splitter added
between the columns.

<Grid>

<Grid.ColumnDefinitions>
<ColumnDefinition Width=".25*"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Rectangle Grid.Column="0" Fill="Green"/>
<Rectangle Grid.Column="1" Fill="Red"/>
<GridSplitter Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Stretch"
Background="Black"
ShowsPreview="true"
Width="3"/>
</Grid>

HTH
--
Stoitcho Goutsev (100)

"Jan Kucera" <uam@centrum.cz> wrote in message
news:EEE60513-B25E-4DCB-A489-29AC60816E15@microsoft.com...
> Hi again...
>
> How can I layout the window something like
> <table width=100% height=100%>
> <tr>
> <td width=25% />
> <td />
> </tr>
> </table>
>
> and make the controls in the cells like Dock=Fill?
>
> Is it possible to make the column user-resizable without using
> WindowsForms SplitContainer control?
>
> Thanks,
> Jan



My System SpecsSystem Spec
Old 11-09-2006   #3 (permalink)
Douglas Stockwell


 
 

Re: Simple table layout

Actually, since the default width is 1*, if you write .25* you end up with a
width of only 20%. Star is not a percentage, it is a weighted value (see the
doco on GridUnitType for details).

So you are better off setting both widths to Star values:

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>

- Doug

"Stoitcho Goutsev (100)" <100@100.com> wrote in message
news:%23GNKrDBBHHA.3540@TK2MSFTNGP03.phx.gbl...
> Jan,
>
> That would be something like
> <Grid>
>
> <Grid.ColumnDefinitions>
> <ColumnDefinition Width=".25*"/>
> <ColumnDefinition />
> </Grid.ColumnDefinitions>
>
> <Grid.RowDefinitions>
> <RowDefinition/>
> </Grid.RowDefinitions>
>
> <Rectangle Grid.Column="0" Fill="Green"/>
> <Rectangle Grid.Column="1" Fill="Red"/>
>
> </Grid>
>
> I added rectangles in the cells just to show the cell boundaries. Normally
> controls will stretch to fill out all the available space (as the
> rectangles do in the example), but if this is not the default behavior for
> a given control you can set contro's HorizontalAlignment and
> VerticalAlignment to *Stretch*
>
> WPF provides control called GridSplitter, which purpose is to provide UI
> for changing size of 2 adjacent columns or rows. There are couple of ways
> how to add a splitter to a grid so I suggest reading in the docs for
> example a splitter can be added to one of the columns or in a column by
> itself, it has to be properly aligned and so on.
> Here is an example with the previous grid, but it also have a splitter
> added between the columns.
>
> <Grid>
>
> <Grid.ColumnDefinitions>
> <ColumnDefinition Width=".25*"/>
> <ColumnDefinition />
> </Grid.ColumnDefinitions>
>
> <Grid.RowDefinitions>
> <RowDefinition/>
> </Grid.RowDefinitions>
> <Rectangle Grid.Column="0" Fill="Green"/>
> <Rectangle Grid.Column="1" Fill="Red"/>
> <GridSplitter Grid.Column="0"
> HorizontalAlignment="Right"
> VerticalAlignment="Stretch"
> Background="Black"
> ShowsPreview="true"
> Width="3"/>
> </Grid>
>
> HTH
> --
> Stoitcho Goutsev (100)
>
> "Jan Kucera" <uam@centrum.cz> wrote in message
> news:EEE60513-B25E-4DCB-A489-29AC60816E15@microsoft.com...
>> Hi again...
>>
>> How can I layout the window something like
>> <table width=100% height=100%>
>> <tr>
>> <td width=25% />
>> <td />
>> </tr>
>> </table>
>>
>> and make the controls in the cells like Dock=Fill?
>>
>> Is it possible to make the column user-resizable without using
>> WindowsForms SplitContainer control?
>>
>> Thanks,
>> Jan

>
>


My System SpecsSystem Spec
Old 11-10-2006   #4 (permalink)
Stoitcho Goutsev \(100\)


 
 

Re: Simple table layout

Hi Doug,

Thanks for the correction. Of course you are right.


--
Stoitcho Goutsev (100)



"Douglas Stockwell" <doug@remove.11011.net> wrote in message
news:668BD948-3F01-4F3C-96EA-A70BB90EE8FB@microsoft.com...
> Actually, since the default width is 1*, if you write .25* you end up with
> a width of only 20%. Star is not a percentage, it is a weighted value (see
> the doco on GridUnitType for details).
>
> So you are better off setting both widths to Star values:
>
> <Grid.ColumnDefinitions>
> <ColumnDefinition Width="1*"/>
> <ColumnDefinition Width="3*" />
> </Grid.ColumnDefinitions>
>
> - Doug
>
> "Stoitcho Goutsev (100)" <100@100.com> wrote in message
> news:%23GNKrDBBHHA.3540@TK2MSFTNGP03.phx.gbl...
>> Jan,
>>
>> That would be something like
>> <Grid>
>>
>> <Grid.ColumnDefinitions>
>> <ColumnDefinition Width=".25*"/>
>> <ColumnDefinition />
>> </Grid.ColumnDefinitions>
>>
>> <Grid.RowDefinitions>
>> <RowDefinition/>
>> </Grid.RowDefinitions>
>>
>> <Rectangle Grid.Column="0" Fill="Green"/>
>> <Rectangle Grid.Column="1" Fill="Red"/>
>>
>> </Grid>
>>
>> I added rectangles in the cells just to show the cell boundaries.
>> Normally controls will stretch to fill out all the available space (as
>> the rectangles do in the example), but if this is not the default
>> behavior for a given control you can set contro's HorizontalAlignment and
>> VerticalAlignment to *Stretch*
>>
>> WPF provides control called GridSplitter, which purpose is to provide UI
>> for changing size of 2 adjacent columns or rows. There are couple of ways
>> how to add a splitter to a grid so I suggest reading in the docs for
>> example a splitter can be added to one of the columns or in a column by
>> itself, it has to be properly aligned and so on.
>> Here is an example with the previous grid, but it also have a splitter
>> added between the columns.
>>
>> <Grid>
>>
>> <Grid.ColumnDefinitions>
>> <ColumnDefinition Width=".25*"/>
>> <ColumnDefinition />
>> </Grid.ColumnDefinitions>
>>
>> <Grid.RowDefinitions>
>> <RowDefinition/>
>> </Grid.RowDefinitions>
>> <Rectangle Grid.Column="0" Fill="Green"/>
>> <Rectangle Grid.Column="1" Fill="Red"/>
>> <GridSplitter Grid.Column="0"
>> HorizontalAlignment="Right"
>> VerticalAlignment="Stretch"
>> Background="Black"
>> ShowsPreview="true"
>> Width="3"/>
>> </Grid>
>>
>> HTH
>> --
>> Stoitcho Goutsev (100)
>>
>> "Jan Kucera" <uam@centrum.cz> wrote in message
>> news:EEE60513-B25E-4DCB-A489-29AC60816E15@microsoft.com...
>>> Hi again...
>>>
>>> How can I layout the window something like
>>> <table width=100% height=100%>
>>> <tr>
>>> <td width=25% />
>>> <td />
>>> </tr>
>>> </table>
>>>
>>> and make the controls in the cells like Dock=Fill?
>>>
>>> Is it possible to make the column user-resizable without using
>>> WindowsForms SplitContainer control?
>>>
>>> Thanks,
>>> Jan

>>
>>

>



My System SpecsSystem Spec
Old 11-10-2006   #5 (permalink)
Jan Kucera


 
 

Re: Simple table layout

Hi,
thank you for your help. I wouldn't manage the star thing. ;-)

Jan

"Stoitcho Goutsev (100)" <100@100.com> wrote in message
news:%23Ta9b1NBHHA.2316@TK2MSFTNGP04.phx.gbl...
> Hi Doug,
>
> Thanks for the correction. Of course you are right.
>
>
> --
> Stoitcho Goutsev (100)
>
>
>
> "Douglas Stockwell" <doug@remove.11011.net> wrote in message
> news:668BD948-3F01-4F3C-96EA-A70BB90EE8FB@microsoft.com...
>> Actually, since the default width is 1*, if you write .25* you end up
>> with a width of only 20%. Star is not a percentage, it is a weighted
>> value (see the doco on GridUnitType for details).
>>
>> So you are better off setting both widths to Star values:
>>
>> <Grid.ColumnDefinitions>
>> <ColumnDefinition Width="1*"/>
>> <ColumnDefinition Width="3*" />
>> </Grid.ColumnDefinitions>
>>
>> - Doug
>>
>> "Stoitcho Goutsev (100)" <100@100.com> wrote in message
>> news:%23GNKrDBBHHA.3540@TK2MSFTNGP03.phx.gbl...
>>> Jan,
>>>
>>> That would be something like
>>> <Grid>
>>>
>>> <Grid.ColumnDefinitions>
>>> <ColumnDefinition Width=".25*"/>
>>> <ColumnDefinition />
>>> </Grid.ColumnDefinitions>
>>>
>>> <Grid.RowDefinitions>
>>> <RowDefinition/>
>>> </Grid.RowDefinitions>
>>>
>>> <Rectangle Grid.Column="0" Fill="Green"/>
>>> <Rectangle Grid.Column="1" Fill="Red"/>
>>>
>>> </Grid>
>>>
>>> I added rectangles in the cells just to show the cell boundaries.
>>> Normally controls will stretch to fill out all the available space (as
>>> the rectangles do in the example), but if this is not the default
>>> behavior for a given control you can set contro's HorizontalAlignment
>>> and VerticalAlignment to *Stretch*
>>>
>>> WPF provides control called GridSplitter, which purpose is to provide UI
>>> for changing size of 2 adjacent columns or rows. There are couple of
>>> ways how to add a splitter to a grid so I suggest reading in the docs
>>> for example a splitter can be added to one of the columns or in a column
>>> by itself, it has to be properly aligned and so on.
>>> Here is an example with the previous grid, but it also have a splitter
>>> added between the columns.
>>>
>>> <Grid>
>>>
>>> <Grid.ColumnDefinitions>
>>> <ColumnDefinition Width=".25*"/>
>>> <ColumnDefinition />
>>> </Grid.ColumnDefinitions>
>>>
>>> <Grid.RowDefinitions>
>>> <RowDefinition/>
>>> </Grid.RowDefinitions>
>>> <Rectangle Grid.Column="0" Fill="Green"/>
>>> <Rectangle Grid.Column="1" Fill="Red"/>
>>> <GridSplitter Grid.Column="0"
>>> HorizontalAlignment="Right"
>>> VerticalAlignment="Stretch"
>>> Background="Black"
>>> ShowsPreview="true"
>>> Width="3"/>
>>> </Grid>
>>>
>>> HTH
>>> --
>>> Stoitcho Goutsev (100)
>>>
>>> "Jan Kucera" <uam@centrum.cz> wrote in message
>>> news:EEE60513-B25E-4DCB-A489-29AC60816E15@microsoft.com...
>>>> Hi again...
>>>>
>>>> How can I layout the window something like
>>>> <table width=100% height=100%>
>>>> <tr>
>>>> <td width=25% />
>>>> <td />
>>>> </tr>
>>>> </table>
>>>>
>>>> and make the controls in the cells like Dock=Fill?
>>>>
>>>> Is it possible to make the column user-resizable without using
>>>> WindowsForms SplitContainer control?
>>>>
>>>> Thanks,
>>>> Jan
>>>
>>>

>>

>
>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Typed datasets and table table adapters components not showing inToolbox .NET General
how do you create a dynamic table/pivot table .NET General
Format-Table PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46