【发布时间】:2015-12-22 21:08:09
【问题描述】:
您能解释一下为什么我的 ComboBox 中的 Tapped 事件不会引发指定的方法吗?
<ComboBox HorizontalAlignment="Center" Margin="19,9.5,19,9.5" Header="Choose the type of the plot" FontSize="15">
<ComboBoxItem Content="Signal Winner" Tapped="Winner_Signal_Tapped" />
<ComboBoxItem Content="Filtered signal Winner" Tapped="Winner_Prediction_Tapped" />
<ComboBoxItem Content="Quality Winner" Tapped="Winner_Quality_Tapped" />
<ComboBoxItem Content="Error Winner" Tapped="Winner_Error_Tapped" />
<ComboBoxItem Content="Signal LMS" Tapped="LMS_Signal_Tapped" />
<ComboBoxItem Content="Filtered signal LMS" Tapped="LMS_Prediction_Tapped" />
<ComboBoxItem Content="Quality LMS" Tapped="LMS_Quality_Tapped" />
<ComboBoxItem Content="Error LMS" Tapped="LMS_Error_Tapped" />
</ComboBox>
private void plotButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (LMSPlot != null)
{
graphGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
var line1 = plot1.Series[0] as LineSeries;
line1.ItemsSource = LMSPlot;
}
if (WinnerPlot != null)
{
graphGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
var line1 = plot1.Series[0] as LineSeries;
line1.ItemsSource = WinnerPlot;
}
}
catch(Exception ex)
{
//for debug purpose
}
}
附:我指出,如果我在 ComboBox 中只保留 4 个项目,点击事件会起作用并调用指定的方法。但是,如果我放 5-8,则没有任何效果。为什么?
【问题讨论】:
-
你为什么不使用组合框的选择更改事件?
-
@Muhammad Saifullah,组合框没有阳光事件。唯一的事件“Tapped”
标签: c# windows-phone-8.1