MainPage.xaml
<UserControl xmlns:my=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data” x:Class=”Tips.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”
xmlns:local=”clr-namespace:Tips”
d:DesignHeight=”300″ d:DesignWidth=”400″>
<Grid x:Name=”LayoutRoot”>
<ListBox x:Name=”lb” Width=”100″ Background=”Beige” Height=”100″/>
</Grid>
</UserControl>
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace Tips
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
Loaded += new System.Windows.RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
dt.Interval = new TimeSpan(0, 0, 0, 0, 1000); // 1000 Milliseconds
dt.Tick += new EventHandler(dt_Tick); // callback
dt.Start();
List<string> item = new List<string>();
item.Add(“A”);
item.Add(“B”);
item.Add(“C”);
item.Add(“D”);
lb.ItemsSource = item;
}
void dt_Tick(object sender, EventArgs e)
{
List<string> item = new List<string>();
for (int i = 1; i < lb.Items.Count; i++)
{
item.Add(lb.Items[i].ToString());
}
item.Add(lb.Items[0].ToString());
lb.ItemsSource = item;
}
}
}
Sharker Khaleed Mahmud
Software Developer




