开发者

Silverlight Grid Layout

When I have Grid in Silverlight, and I provide Column Definitions like below

    <Grid.ColumnDefinitions>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>            
    </Grid.ColumnDefinitions>

For some reason the items that get placed in those columns get cut off. That is I only see half the control. But when I do

   <Grid.RowDefinitions>
        <RowDefinition>&l开发者_运维问答t;/RowDefinition>
        <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>

and put items in those respected rows I can see the entire items with their proper respective widths and heights.

What could I be overlooking?

Thanks


<Grid.ColumnDefinitions> 
    <ColumnDefinition></ColumnDefinition> 
    <ColumnDefinition></ColumnDefinition>             
</Grid.ColumnDefinitions> 

is actually just a short cut for

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*"/>
            <ColumnDefinition Width="0.5*"/>
        </Grid.ColumnDefinitions>

which means, you have two columns in this Grid, each takes 50% of the width.

Same way,

   <Grid.RowDefinitions>         
        <RowDefinition></RowDefinition>         
        <RowDefinition></RowDefinition>         
    </Grid.RowDefinitions>

is the same as

        <Grid.RowDefinitions>
            <RowDefinition Height="0.5*"/>
            <RowDefinition Height="0.5*"/>
        </Grid.RowDefinitions>

Hope this helps. :)


Look for following link. It should help you:
Using the Grid control in Silverlight

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜