Bigeyes
Bigeyes

Reputation: 1686

Stackpanels side by side

I want to put stackPanels side by side. Then in each stack panel, there are different controls. Now the first stack panel is working. It has textblocks and text boxs. Now I want to add a button on the second stack panel and so on. The question is that the second panel doesn't show the button's content. Not sure why?

<StackPanel Orientation="Vertical">
    <StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Left" Margin="10">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"></RowDefinition>
                        <RowDefinition Height="25"></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" Grid.Row="0" Text="Year" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Week" TextAlignment="Center"></TextBlock>
                    <TextBlock Grid.Column="2" Grid.Row="0" Text="File Location" TextAlignment="Center"></TextBlock>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0" Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Button Grid.Column="0" Grid.Row="0">
                        <TextBlock Text="Get Informations" TextWrapping="Wrap" TextAlignment="Center"></TextBlock>
                    </Button>
                </Grid>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1"></StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1"></StackPanel>
        </Grid>

    </StackPanel>
</StackPanel>

Upvotes: 0

Views: 214

Answers (1)

Ateik
Ateik

Reputation: 2586

You are setting the width of the Stackpanel as 300, if you want a solution. either remove the stackpnael (the one that has 300 width) or fix the Grid inside that stackpanel to be 300

Upvotes: 1

Related Questions