![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| | #5 (permalink) |
| | 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 Specs![]() |
| 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 | |||