I am new to LINQ. I would like to use it in my project using WPF. I have two listBoxes for each wpf page (ListBox1 in first wpf Page and ListBox2 in second wpf Page). I need to pass selected value(s) from ListBox1 to ListBox2.
The First WPF Page : ListBox1
private void btnNext_Click(object sender, RoutedEventArgs e)
{
List<FoodInformation> _dinners = (from ListItem item in ListOfFood.Items
where item.selecteditem select item).ToList();
//(above: this linq - item.SelectedItems doesnt work. How?)
var passValue = new ScheduleOperation(_dinners);
Switcher.Switch(passValue); //go to another page
}
The Second WPF Page: ListBox2
public ScheduleOperation(List<FoodInformation> items)
: this()
{
valueFromSelectionOperation = items;
ListOfSelectedDinners.ItemsSource ;
ListOfSelectedDinners.DisplayMemberPath = "Dinner";
}
Your help with coding would be highly appreciated. Thanks!