void BindComboBox() { var list = new List <KeyValueComboBoxItem>(); list.Add(new KeyValueComboBoxItem(0, "请选择")); list.Add(new KeyValueComboBoxItem(1, "金")); list.Add(new KeyValueComboBoxItem(2, "橙")); list.Add(new KeyValueComboBoxItem(3, "紫")); list.Add(new KeyValueComboBoxItem(4, "蓝")); list.Add(new KeyValueComboBoxItem(5, "绿")); ComboBoxHelper.BindComboBox(cmbItemSubType, list); cmbItemSubType.SelectedIndex = 0; var list2 = new List <KeyValueComboBoxItem>(); list2.Add(new KeyValueComboBoxItem(0, "所有")); list2.Add(new KeyValueComboBoxItem(1, "英超联赛")); list2.Add(new KeyValueComboBoxItem(2, "西甲联赛")); list2.Add(new KeyValueComboBoxItem(3, "德甲联赛")); list2.Add(new KeyValueComboBoxItem(4, "意甲联赛")); list2.Add(new KeyValueComboBoxItem(5, "法甲联赛")); ComboBoxHelper.BindComboBox(cmbItemThirdType, list2); cmbItemThirdType.SelectedIndex = 0; BindItem(); }
private void BindItem() { subType = ComboBoxHelper.GetSelectValueInt(cmbItemSubType); thirdType = ComboBoxHelper.GetSelectValueInt(cmbItemThirdType); if (_subType == subType && _thirdType == thirdType) { return; } _subType = subType; _thirdType = thirdType; var list = _playerCache.FindAll(d => d.CardLevel == subType && (thirdType == 0 || d.LeagueLevel == thirdType)); var cmblist = new List <KeyValueComboBoxItem>(list.Count); if (list.Count > 0) { cmblist.Add(new KeyValueComboBoxItem(0, "请选择")); foreach (var dicItem in list) { cmblist.Add(new KeyValueComboBoxItem(dicItem.Idx, dicItem.Name)); } } else { cmblist.Add(new KeyValueComboBoxItem(0, "无")); } ComboBoxHelper.BindComboBox(cmbItemCode, cmblist); cmbItemCode.SelectedIndex = 0; }
/// <summary>绑定ComboBox /// /// </summary> private void BindComboBox() { List <DatabaseTable> tables = m_dbSchema.DatabaseSchema.Tables; if (tables != null) { ComboBoxHelper.BindComboBox(cboTable, tables, "Name", "Name"); } cboTable.Text = GlobalHelp.TreeView.SelectedNode.Text; }
private void ManagerSelectWindow_OnLoaded(object sender, RoutedEventArgs e) { if (_isLoad) { return; } ComboBoxHelper.BindComboBox(cmbType, LocalHelper.NpcTypes); cmbType.SelectedIndex = 0; BindData(); _isLoad = true; }
/// <summary>初始化绑定 /// /// </summary> private void DoInitData() { const string strBindEditSql = "select TableName From CacheTables;SELECT 'cboEditTableName '"; BindClass bindClass = new BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindEditSql }; DataSet ds = BindSourceHelper.GetBindSourceDataSet(bindClass, GlobalHelp.Conn); ComboBoxHelper.BindComboBox(cboEditTableName, ds.Tables["cboEditTableName"], "TableName", "TableName"); }
/// <summary>初始化绑定 /// /// </summary> private void DoInitData() { const string strBindSql = "select '学习记录' as Name union all select '其它记录' as Name ;SELECT 'cboEditType '"; BindClass bindClass = new BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindSql }; DataSet ds = BindSourceHelper.GetBindSourceDataSet(bindClass, GlobalHelp.Conn); ComboBoxHelper.BindComboBox(cboEditType, ds.Tables["cboEditType"], "Name", "Name"); }
/// <summary>初始化Detail绑定 /// /// </summary> private void DoInitDetailData() { const string strBindEditSql = "SELECT ProjectID,Name From BseProject;SELECT 'cboDetailEditProjectID '"; BindClass bindClass = new BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindEditSql }; DataSet ds = BindSourceHelper.GetBindSourceDataSet(bindClass, GlobalHelp.Conn); ComboBoxHelper.BindComboBox(cboDetailEditProjectID, ds.Tables["cboDetailEditProjectID"], "Name", "ProjectID"); }
/// <summary>初始化Master绑定 /// /// </summary> private void DoInitMasterData() { const string strBindEditSql = "SELECT Name,value FROM [BseDictionary] WHERE ParentID=19;SELECT Name,value FROM [BseDictionary] WHERE ParentID=22;SELECT 'cboEditCategory ','cboEditOnLevel '"; BindClass bindClass = new BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindEditSql }; DataSet ds = BindSourceHelper.GetBindSourceDataSet(bindClass, GlobalHelp.Conn); ComboBoxHelper.BindComboBox(cboEditCategory, ds.Tables["cboEditCategory"], "Name", "Value"); ComboBoxHelper.BindComboBox(cboEditOnLevel, ds.Tables["cboEditOnLevel"], "Name", "Value"); }
private void cmbModule_SelectionChanged(object sender, SelectionChangedEventArgs e) { var module = ComboBoxHelper.GetSelectValue(cmbModule); var moduleEntity = CacheHelper.Instance.GetModule(module); lblModuleState.Content = GetStateStr(moduleEntity.Status); if (CacheHelper.Instance.ActionComboDic.ContainsKey(module)) { ComboBoxHelper.BindComboBox(cmbAction, CacheHelper.Instance.ActionComboDic[module]); btnRequest.IsEnabled = true; } else { cmbAction.ItemsSource = null; btnRequest.IsEnabled = false; } }
/// <summary>绑定ComboBox /// /// </summary> private void BindComboBox() { List <DatabaseTable> tables = m_dbSchema.DatabaseSchema.Tables; if (tables != null) { ComboBoxHelper.BindComboBox(cboTable, tables, "Name", "Name"); if (m_codeGenType == CodeGenType.WinFromParentChildEditWithDialog) { DataTable databaseTable = new DataTable(); databaseTable.Columns.Add("Name", typeof(string)); foreach (DatabaseTable item in tables) { DataRow dr = databaseTable.NewRow(); dr[0] = item.Name; databaseTable.Rows.Add(dr); } ComboBoxHelper.BindComboBox(cboTableDetail, databaseTable, "Name", "Name"); cboTableDetail.Text = GlobalHelp.TreeView.SelectedNode.Text; } } cboTable.Text = GlobalHelp.TreeView.SelectedNode.Text; }
private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { ComboBoxHelper.BindComboBox(cmbModule, CacheHelper.Instance.ModuleCombo); }