Simple as that:
var activities = (List<Activity>)listbox1.ItemsSource;
var myObject = (Activity)listbox1.SelectedItem;
activities.Remove(listbox1.SelectedItem);
myObject.Date = DateTime.Now; //to provide your last request(add the current date)
var activities2 = (List<Activity>)listbox2.ItemsSource;
if(activities2 == null)
{
activities2 = new List<Activity>();
listbox2.ItemsSource = activities2;
}
activities2.Add(myObject);
To be sure that the ListBox update their items do
listbox1.ItemsSource = null;
listbox1.ItemsSource = activities;
and
listbox2.ItemsSource = null;
listbox2.ItemsSource = activities2;
or simply use ObservableCollection<Activity>
instead of List<Activity>
and the ListBoxes should automatically update their items.
EDIT: fixed ItemTemplate for second ListBox
<ListBox Height="395" HorizontalAlignment="Left" Margin="27,195,0,0" Name="listBox1" VerticalAlignment="Top" Width="410" AllowDrop="False" ItemsSource="{Binding activities}">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Height="150" Width="400" Click="Act_Click">
<Grid>
<TextBlock Text="{Binding Type}" TextAlignment="Left"/>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" TextAlignment="Left"/>
</Grid>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ListBox Height="491" HorizontalAlignment="Left" Margin="10,105,0,0" Name="listBox2" VerticalAlignment="Top" Width="436" ItemsSource="{Binding activities2}">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Height="150" Width="400">
<Grid>
<TextBlock Text="{Binding Type}" TextAlignment="Left"/>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" TextAlignment="Left"/>
</Grid>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>