/** * 加载所有菜系 * */ private void LoadAllDishTypes() { List <DishTypeData> dishTypeDatas = DishInfoConnector.GetDishTypeDatas(); foreach (DishTypeData typeData in dishTypeDatas) { AddDishType.Items.Add(typeData.DtTitle); } AddDishType.SelectedIndex = 0; }
/** * 加载所有的菜系信息 * */ private void LoadAllDishType() { List <DishTypeData> dishTypeDatas = DishInfoConnector.GetDishTypeDatas(); ModifyDishTypeCombo.IsEnabled = true; foreach (DishTypeData typeData in dishTypeDatas) { SearchDishTypeCombo.Items.Add(typeData.DtTitle); ModifyDishTypeCombo.Items.Add(typeData.DtTitle); } ModifyDishTypeCombo.IsEnabled = false; }
/* * 动态加载菜系的方法 * */ private void AddDishTypeList() { List <ListBoxItem> listBoxItems = new List <ListBoxItem>(); dishTypeDatas = DishInfoConnector.GetDishTypeDatas(); foreach (DishTypeData dishType in dishTypeDatas) { ListBoxItem item = new ListBoxItem { Content = dishType.DtTitle.Trim(), MaxWidth = 45, FontSize = 10 }; listBoxItems.Add(item); } DishTypeList.ItemsSource = listBoxItems; }
/* * 加载所有菜系 * */ private void LoadAllDishType() { int count = DishTypeList.Items.Count; for (int i = 0; i < count; i++) { DishTypeList.Items.RemoveAt(0); } dishTypeDatas = DishInfoConnector.GetDishTypeDatas(); foreach (DishTypeData typeData in dishTypeDatas) { ListBoxItem listBoxItem = new ListBoxItem() { Content = typeData.DtTitle, FontSize = 14, Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)) }; DishTypeList.Items.Add(listBoxItem); } }