using BBWY.Client.Models; using BBWY.Controls; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; namespace BBWY.Client.Views { /// /// SelectShop.xaml 的交互逻辑 /// public partial class SelectShopW : BWindow { public IList DepartmentList { get; set; } public Shop Shop { get; set; } public SelectShopW(IList departmentList) { InitializeComponent(); this.DepartmentList = departmentList; this.Loaded += SelectShop_Loaded; } private void SelectShop_Loaded(object sender, RoutedEventArgs e) { var d = cbx_department.SelectedItem as Department; cbx_shop.ItemsSource = d.ShopList; } private void btn_ok_Click(object sender, RoutedEventArgs e) { Shop = cbx_shop.SelectedItem as Shop; this.DialogResult = true; this.Close(); } private void cbx_department_SelectionChanged(object sender, SelectionChangedEventArgs e) { var d = cbx_department.SelectedItem as Department; cbx_shop.ItemsSource = d.ShopList; cbx_shop.SelectedIndex = 0; } } }