<Grid Grid.Row="1" Name="advertGrid">
<ListBox Name="advertListBox">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Name="imgAdvertisement"
Source="{Binding AdPic}" Stretch="Fill" Height="112">
</Image>
<!--</StackPanel>-->
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
public void ProcessAdvert(string[] result)
{
string resu = "";
List<Advert> list = new List<Advert>();
for (int i = 0; i < result.Length; i++)
{
string adPic = array[2].Trim();
int duration = Convert.ToInt32(array[4].Trim()); 广告显示的时间
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(duration);
timer.Tick += timer_Tick;
timer.Start();
list.Add(new Advert() {AdPic = "http://192.168.10.1/advert/" + adPic});
}
advertListBox.ItemsSource = list;
}
void timer_Tick(object sender, EventArgs e)
{
//this.advertListBox.Padding = new Thickness(0, -122, 0, 0);
}