简体   繁体   English

Windows Phone-实时显示网格中的项目

[英]Windows Phone - Showing items in grid in 'real time'

I have a grid with 4 columns and 4 rows. 我有一个4列4行的网格。 After I press button i would like make it looks like game machine. 我按下按钮后,我想使其看起来像游戏机。 I have Images array and I while I am looping through this array I would like to see this in action but all after I press the buttin I see my image in the last position. 我有Images数组,当我循环遍历此数组时,我希望看到它的作用,但是在按下按钮之后,所有的一切我都将图像放在最后一个位置。 Is it possible to do it in something like ' real time ' ? 是否有可能以“实时”之类的方式进行?

        int row = 0;
        foreach (Image image in images)
        {
            Grid.SetColumn(image, 0);
            Grid.SetRow(image, row);
            row++;
        }    

Inside your for each loop before increment add a code 在您的每个循环内,在增量之前添加代码

await System.Threading.Tasks.Task.Delay(1100);

Since its looping too fast u seeing only the last element with a Delay set you will be able to see all colors being set. 由于其循环太快,您只能看到设置了Delay的最后一个元素,因此您将能够看到所有已设置的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM