C# 在组合框中显示表格的信息

C# 在组合框中显示表格的信息,c#,wpf,entity-framework,stored-procedures,C#,Wpf,Entity Framework,Stored Procedures,我试图将sql表中的州信息显示到combobox1中,根据我们在combobox1中选择的内容,我想显示该州的城市。 wpf和实体框架 需要帮忙吗 表格状态: id int, 姓名nvarchar(50) 表城市: id int, 名称nvarchar(50), stateId int您必须创建包含所有状态对象的列表StateList, 给予 XAML ` C# 列表状态列表//所有状态 您的代码在哪里? <ComboBox ItemsSource = {Binding StateLis

我试图将sql表中的州信息显示到combobox1中,根据我们在combobox1中选择的内容,我想显示该州的城市。 wpf和实体框架 需要帮忙吗 表格状态: id int, 姓名nvarchar(50)

表城市: id int, 名称nvarchar(50),
stateId int

您必须创建包含所有状态对象的
列表StateList
, 给予

XAML
`
C#
列表状态列表//所有状态

您的代码在哪里?
<ComboBox ItemsSource = {Binding StateList} SelectedItem = {Binding State} 
DisplayMamberPath = "Name"/>`
List<State> StateList // All State