Home > DeveloperSection > Forums > stackpanel within grid in windows phone does not work
Pravesh Singh
Pravesh Singh

Total Post:101

Points:709
Posted on    May-18-2013 1:30 AM

 Windows Phone Windows Phone 
Ratings:


 1 Reply(s)
 1388  View(s)
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 


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    May-18-2013 8:33 AM

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"


Don't want to miss updates? Please click the below button!

Follow MindStick