首页 > 解决方案 > 在组合框中显示表格的信息

问题描述

我正在尝试将 sql 中的表中的状态信息显示到组合框 1 中,并根据我们在组合框 1 中选择的内容,我想显示该州的城市。wpf 和实体框架需要一些帮助表状态:id int, name nvarchar(50)

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

标签: c#wpfentity-frameworkstored-procedures

解决方案


你必须创建List<State> StateList包含所有状态对象,给

XAML

<ComboBox ItemsSource = {Binding StateList} SelectedItem = {Binding State} 
DisplayMamberPath = "Name"/>`

C#

List<State> StateList // All State

推荐阅读