I have 2 comboboxes each with 2 methods for _Loaded and _Selection changed
i want to select a location in the first combobox and then the next combobox should list a bunch of dates for that specific location
Here is what i have so far:
<ComboBox
x:Name="comboBoxLocation"
Text="Lokation"
HorizontalAlignment="Left" Margin="50,305,0,0"
VerticalAlignment="Top"
Width="120"
Loaded="ComboBoxLocation_Loaded"
SelectionChanged="ComboBoxLocation_SelectionChanged"/>
<ComboBox x:Name="comboBoxDate"
Text="Dato" HorizontalAlignment="Left"
Margin="195,305,0,0"
VerticalAlignment="Top" Width="120"
Loaded="ComboBoxDate_Loaded"
SelectionChanged="ComboBoxDate_SelectionChanged"/>
and
private void ComboBoxLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var comboBoxLocation = sender as ComboBox;
comboBoxDate.SelectedIndex = 0;
comboBoxDate.ItemsSource = controller.GetBusTimes();
//ComboBoxDate_Loaded(sender, e);
}
private void ComboBoxDate_Loaded(object sender, RoutedEventArgs e)
{
List<string> dataDate = controller.GetBusTimes();
var comboBoxDate = sender as ComboBox;
comboBoxDate.ItemsSource = dataDate;
}
This seems to be a lot more difficult than i expected... I am starting to think that i might have madesome fundamental mistake here...
I have been fiddling around with this... I can manage to show a list of locations in the first box and the relevant dates for that location the second box. But when i change the first location, the dates stay the same...
How would i go about this?