【发布时间】:2014-10-07 04:54:24
【问题描述】:
我想这样做,一旦我选择了first_ComboBox 的第一项(Student Information),就会出现second_ComboBox。
我怎样才能做到这一点
在cs代码中
private void first_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void second_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
在 XAML 中
<StackPanel Margin="97,47,171,499" Orientation="Horizontal" Grid.Row="1">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Where You want to Control" VerticalAlignment="Top" Height="82" Width="463" FontSize="36"/>
<ComboBox x:Name="first_ComboBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="560" Height="42" SelectionChanged="first_ComboBox_SelectionChanged">
<x:String>Student Information</x:String>
<x:String>Staff Information</x:String>
<x:String>Academic Information</x:String>
</ComboBox>
</StackPanel>
<StackPanel Margin="97,172,171,374" Orientation="Horizontal" Grid.Row="1">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Select the Field" VerticalAlignment="Top" Height="82" Width="463" FontSize="36"/>
<ComboBox x:Name="second_ComboBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="560" Height="42" SelectionChanged="second_ComboBox_SelectionChanged">
<x:String>Student Name</x:String>
<x:String>Student Address</x:String>
</ComboBox>
</StackPanel>
【问题讨论】:
-
你想在两个组合框上显示相同的信息吗?
-
不,我希望一旦我选择了第一个组合框的第一项,就想显示第二个组合框
-
在两个不同的列表框中嵌入堆栈面板,然后在您喜欢的任何事件上使用 c# 代码使其可见或隐藏它 lstEvents.Visibility = System.Windows.Visibility.Collapsed; prLoading.Visibility = System.Windows.Visibility.collapsed;
-
聪明的开发者我该怎么做?
标签: c# xaml combobox windows-store-apps windows-8.1