1 回答
TA贡献1773条经验 获得超3个赞
这是因为您的变量位于 MainWindow() 方法内部。尝试这个:
public partial class MainWindow : Window
{
List<EqualisationSetting> equalisationSettings;
public MainWindow()
{
InitializeComponent();
equalisationSettings = new List<EqualisationSetting>
{
new EqualisationSetting { LowerFrequencyBound = 20, UpperFrequencyBound = 250, DecibelRatioChange = 0 },
new EqualisationSetting { LowerFrequencyBound = 250, UpperFrequencyBound = 4000, DecibelRatioChange = 0}
};
ItemsCountroller.ItemsSource = equalisationSettings;
}
private void AddFrequencyBoundButton_Click(object sender, RoutedEventArgs e)
{
equalisationSettings.add(new EqualisationSetting();
}
}
- 1 回答
- 0 关注
- 85 浏览
添加回答
举报