======================前台代码===========================
<UserControl x:Class="SilverlightApplication10.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<TextBlock x:Name="txt1"></TextBlock>
</Grid>
</UserControl>
====================后台=============================
Imports System.Windows.Threading
Partial Public Class MainPage
Inherits UserControl
Public Sub New()
InitializeComponent()
Dim time1 As New DispatcherTimer
time1.Interval = New TimeSpan(0, 0, 1)
AddHandler time1.Tick, AddressOf time_tick
time1.Start()
End Sub
Public Sub time_tick()
txt1.Text = "现在的时间是:" & Now.ToString
End Sub
End Class