Amin
Amin
CC#
Created by Amin on 5/17/2024 in #help
WPF Acquiring an Item clicked in a ListBox
As stated I'm trying to acquire a specific dataype from an object that's in a listbox, but I'm just trying to get a hand at understanding how it works.
C#
private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//selectedFerry = (Ferry)MyListBox.SelectedItem;

if (MyListBox.SelectedItem != null)
{
Console.WriteLine("Hey");
}
}
C#
private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//selectedFerry = (Ferry)MyListBox.SelectedItem;

if (MyListBox.SelectedItem != null)
{
Console.WriteLine("Hey");
}
}
In this piss poor example that I made, my understanding is that if I select an item by clicking on it in the list, it prints out the specific message that I wrote. By that logic, would it be possible for me to acquire specific data that is in the list and storing it in a variable?
3 replies