locked
Grid is bigger than the screen RRS feed

  • Question

  • Hi,

    I have a Grid on a page, and depending on user inputs new elements such as text box or combo box can be added in new columns in the grid. it gets to a point where half of a textbox is cut off at the adge of the screen and i cant work out how to add a horizontal scroll bar

    Anyhelp is appreciated.

    regards CJM

    Wednesday, November 6, 2013 1:03 AM

Answers

  • Put it in a ScrollViewer:

            <ScrollViewer HorizontalScrollBarVisibility="Auto">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                    </Grid.ColumnDefinitions>
                    <Rectangle Grid.Column="0" Fill="Red" />
                    <Rectangle Grid.Column="1" Fill="Orange" />
                    <Rectangle Grid.Column="2" Fill="Yellow" />
                    <Rectangle Grid.Column="3" Fill="Green" />
                    <Rectangle Grid.Column="4" Fill="Blue" />
                    <Rectangle Grid.Column="5" Fill="Indigo" />
                    <Rectangle Grid.Column="6" Fill="Violet" />
                </Grid>
            </ScrollViewer>

    --Rob

    • Marked as answer by c.j.mcnaught Wednesday, November 6, 2013 1:09 AM
    Wednesday, November 6, 2013 1:08 AM
    Moderator

All replies

  • Put it in a ScrollViewer:

            <ScrollViewer HorizontalScrollBarVisibility="Auto">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                        <ColumnDefinition Width="1000" />
                    </Grid.ColumnDefinitions>
                    <Rectangle Grid.Column="0" Fill="Red" />
                    <Rectangle Grid.Column="1" Fill="Orange" />
                    <Rectangle Grid.Column="2" Fill="Yellow" />
                    <Rectangle Grid.Column="3" Fill="Green" />
                    <Rectangle Grid.Column="4" Fill="Blue" />
                    <Rectangle Grid.Column="5" Fill="Indigo" />
                    <Rectangle Grid.Column="6" Fill="Violet" />
                </Grid>
            </ScrollViewer>

    --Rob

    • Marked as answer by c.j.mcnaught Wednesday, November 6, 2013 1:09 AM
    Wednesday, November 6, 2013 1:08 AM
    Moderator
  • genius
    Wednesday, November 6, 2013 1:09 AM