Grid in windows phone 7

前端 未结 4 1055
误落风尘
误落风尘 2021-01-20 12:25

I have a grid view code below which have divided into 3 column. But i have a problem with the code is that. When multiple data is retrieved

4条回答
  •  轮回少年
    2021-01-20 12:32

    A stack panel would have your items display one above the other, though, you may lose relationships between the 3 columns. You could also simply set the grid.row to an index.

        int i = 0;
        foreach (var title in titleSpan)
        {
            {...} 
            Grid.SetColumn(titleTxtBlock, 1);
            Grid.SetRow(titleTxtBlock, i);
    
            schedule.Children.Add(titleTxtBlock);
        }
    

    Do that for each of your for loops and you'll keep the relationship between the elements. If there isn't a relationship between your elements (ie, the first title isn't related to the first category which isnt' related to the first time) then a stackpanel will likely be the best way to go.

提交回复
热议问题