0
<Window x:Class="Repo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Repo="clr-namespace:Repo" Title="Window1" Height="300" Width="300">
<Grid>
<Button Click="SaVeEverythingInDatabase></Button>
<Repo:UserControlTasks/>
</Grid>
</Window>
public class UserControlTasks:userControl
public partial class UserControlTasks: UserControl
{
public UserControlTasks()
{
InitializeComponent();
LoadView();
}
private void LoadView()
{
this.lbTasks.ItemsSource = new TaskModelView();//collectionOfTasks
}
如何從在UserControlTasks lbTasks收集當我點擊主窗口的按鈕?
我必須補充說,我這個集合是類Student的實例的一部分,它是MainWindow的datacontext。