Answer the question
In order to leave comments, you need to log in
The ComboBox_SelectionChanged event set in XAML fires before the entire form is rendered
The form is described in XAML:
<ComboBox Name="comboPartitionTypes" SelectedIndex="0" SelectionChanged="comboPartitionTypes_SelectionChanged">
<ComboBoxItem Content="partition1" />
<ComboBoxItem Content="partition2" />
</ComboBox>
<StackPanel Name="panel1"></StackPanel>
<StackPanel Name="panel2"></StackPanel>
private void comboPartitionTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (comboPartitionTypes.SelectedIndex)
{
case 0:
panel1.Visibility = System.Windows.Visibility.Visible;
panel2.Visibility = System.Windows.Visibility.Hidden;
break;
case 1:
panel1.Visibility = System.Windows.Visibility.Hidden;
panel2.Visibility = System.Windows.Visibility.Visible;
break;
}
}
private void comboPartitionTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!IsLoaded) return;
Answer the question
In order to leave comments, you need to log in
I often find myself thinking that if you run into the need for a strict order of initialization of something, drawing, incoherent calls, etc. etc. is a sign of incorrect application architecture. It is worth sitting to think and drink tea with cookies.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question