I have to choose a category from top combobox (for ex. Adventure, Classic, Science Fiction) then books will be on second combobox based on the category. I don't have much knowledge about this so I need help to understand.
C# code
public SelectCategories()
{
InitializeComponent();
Cat.Items.Add("Adventure");
Cat.Items.Add("Classic");
Cat.Items.Add("Science Fiction");
if (Cat.Text == "Adventure")
{
Book.Items.Add("a");
Book.Items.Add("d");
Book.Items.Add("v");
}
else if(Cat.Text == "Classic")
{
Book.Items.Add("c");
Book.Items.Add("l");
Book.Items.Add("s");
}
}
Xaml code
<ComboBox x:Name="Cat" HorizontalAlignment="Left" Margin="228,66,0,0" VerticalAlignment="Top" Width="186" Height="32" SelectionChanged="ComboBox_SelectionChanged"/>
<ComboBox x:Name="Book" HorizontalAlignment="Left" Margin="228,142,0,0" VerticalAlignment="Top" Width="186" Height="32" SelectionChanged="ComboBox_SelectionChanged_1"/>
<Label Content="Select a Category:" FontSize="16" HorizontalAlignment="Left" Margin="34,66,0,0" VerticalAlignment="Top" Height="32" Width="162"/>
<Label Content="Select a Book:" FontSize="16" HorizontalAlignment="Left" Margin="34,142,0,0" VerticalAlignment="Top" Height="32" Width="162"/>
<Button Content="Add Book to List.." HorizontalAlignment="Left" Margin="34,236,0,0" VerticalAlignment="Top" Width="177" Height="32" Click="Button_Click"/>
<CheckBox Content="Confirm" HorizontalAlignment="Left" Margin="54,316,0,0" VerticalAlignment="Top" Checked="CheckBox_Checked"/>
<Button Content="Next" HorizontalAlignment="Left" Margin="306,356,0,0" VerticalAlignment="Top" Width="113" Height="32" Click="Button_Click_1"/>