STACKPANEL WITHIN GRID IN WINDOWS PHONE DOES NOT WORK

Pravesh Singh

Total Post:101

Points:709
Posted by  Pravesh Singh
 1736  View(s)
Ratings:
Rate this:
Hi Guys

I tried to do this but I got message error : "ColumnDefinition does not support direct content"

   <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="229">
                <StackPanel Margin="0,0,0,17" Grid.ColumnSpan="2">
                    <TextBlock Height="30" Name="l1" Text="first name" />
                    <TextBox InputScope="Number" Height="71" Name="firstName" Text="" Width="460" />
                </StackPanel>
            </ColumnDefinition>
            <ColumnDefinition Width="227">
                <StackPanel Margin="0,0,0,17" Grid.ColumnSpan="2">
                    <TextBlock Height="30" Name="l1" Text="first name" />
                    <TextBox InputScope="Number" Height="71" Name="firstName" Text="" Width="460" />
                </StackPanel>                        
            </ColumnDefinition>
        </Grid.ColumnDefinitions>
    </Grid>


Thanks 
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: stackpanel within grid in windows phone does not work

    Hi Pravesh!


    u cant put the content directly into the column definition, the code should--->

    <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="229"></ColumnDefinition>            
                    <ColumnDefinition Width="227"></ColumnDefinition>   
                </Grid.ColumnDefinitions>


                <StackPanel Grid.Column="0" Margin="0,0,0,17" Grid.ColumnSpan="2">
                            <TextBlock Height="30" Name="l1" Text="first name" />
                            <TextBox InputScope="Number" Height="71" Name="firstName" Text="" Width="460" />
                </StackPanel>

                 <StackPanel Grid.Column="1" Margin="0,0,0,17" Grid.ColumnSpan="2">
                            <TextBlock Height="30" Name="l1" Text="first name" />
                            <TextBox InputScope="Number" Height="71" Name="firstName" Text="" Width="460" />
                 </StackPanel>   

        </Grid>

    u can reference the column number, in which the specific content lies by Grid.Column = "nth Column" ex:- Grid.Column = "0"

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!