我想随机选择一些我的数组。然后我将它显示在一个文本块中。我想每秒都做。如何每秒更新我的文本块?请帮助我。在windows phone 8中每半秒更新文本块的文本
0
A
回答
1
创建一个调度程序计时器,并为每个ticks更新您的textbock。
number = 0
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0,0,1);
dispatcherTimer.Start();
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
//if you use binding and mvvm
this.Text = number.tostring();
//if you don't use binding
yourTextblock.Text = number.toString();
number ++;
}
0
创建调度员计时器和每半秒更新文本框中
int number=0;
private DispatcherTimer _timer;
public sample()
{
InitializeComponent();
_timer = new DispatcherTimer();
_timer.Interval = new TimeSpan(0, 0, 0,0,500);
_timer.Tick += _timer_Tick;
_timer.Start();
}
void _timer_Tick(object sender, EventArgs e)
{
number++;
yourTextblock.Text = number.toString();
}
相关问题
- 1. 在VB中每秒更新文本块的文本Net
- 2. Windows Phone 7永久更新文本块
- 3. Windows Phone的文本块fontautosize
- 4. 在ItemTemplate中定位文本 - Windows Phone 8
- 5. Windows Phone 8中的文本图像
- 6. 列表框和文本块中的Windows Phone 8
- 7. 如何在windows phone 8的文本块上创建字幕?
- 8. 每秒更新通知文本
- 9. Windows Phone 8 Live tiles文本和图像更新
- 10. 占位符文本框的Windows Phone 8
- 11. 与Windows Phone的ň文本框8
- 12. 在windows phone中嵌入文本块文本
- 13. 在windows phone 7中突出显示文本框/文本块
- 14. 如何更改Windows Phone 8中AppBarButton的文本宽度?
- 15. 语音识别到文本Windows Phone 8
- 16. Windows Phone 8 - 可滚动文本框
- 17. 在更改文本时在Windows Phone上启用滑动动画块文本
- 18. Windows Phone 8 xaml文本块绑定格式
- 19. 从类#.cs中更改文本windows phone
- 20. 本地化的Windows Phone 8
- 21. Windows 8 C#/ XAML - 在文本块文本周围创建边框
- 22. 在windows phone 8中创建一个包含文本框的longlist
- 23. 用户在Windows Phone中选择文本的RichTextBox 8
- 24. 在Windows Phone 8文本框中的占位符
- 25. 如何在Windows Phone 8的phonetextbox中掩盖文本?
- 26. Windows Phone 8在TextBox或PhoneTextBox中输入缓慢的文本
- 27. Windows Phone:在运行时更改文本块样式
- 28. 每秒更新Javascript中的文本框值
- 29. DatePicker在Windows Phone中导航的文本
- 30. 的Windows Phone - 文本框
感谢MatDevWp8。它运作良好^^ – Carson