本文整理汇总了C#中System.Windows.Controls.ComboBoxItem类的典型用法代码示例。如果您正苦于以下问题:C# ComboBoxItem类的具体用法?C# ComboBoxItem怎么用?C# ComboBoxItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComboBoxItem类属于System.Windows.Controls命名空间,在下文中一共展示了ComboBoxItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HumanMacroDialog
public HumanMacroDialog(Word.Range text, int jobNumber)
{
this.text = text;
this.jobNumber = jobNumber;
InitializeComponent();
Binding binding = new Binding();
binding.Source = text;
binding.Path = new PropertyPath("Text");
textToWorkWith.SetBinding(TextBox.TextProperty, binding);
numItems.Content = numSections + " paragraph" + (numSections == 1 ? "" : "s") + " selected, each as a separate task";
item1 = new ComboBoxItem();
item1.Content = "Paragraph";
item2 = new ComboBoxItem();
item2.Content = "Sentence";
separatorBox.Items.Add(item1);
separatorBox.Items.Add(item2);
separatorBox.SelectedValue = item1;
returnAsComments = new ComboBoxItem();
returnAsComments.Content = "Comments";
returnAsInline = new ComboBoxItem();
returnAsInline.Content = "In-Line Changes";
returnTypeBox.Items.Add(returnAsComments);
returnTypeBox.Items.Add(returnAsInline);
returnTypeBox.SelectedValue = returnAsComments;
}
示例2: GetDropDown
private void GetDropDown()
{
DataTable dt = Utility.HandleData(d.GetPickListValues("RibbonTemplate__c", "Type__c",false)).dt;
ComboBoxItem i = new ComboBoxItem();
i.Content = "";
cbType.Items.Add(i);
foreach (DataRow r in dt.Rows)
{
i = new ComboBoxItem();
i.Content = r["Value"].ToString();
cbType.Items.Add(i);
}
dt = Utility.HandleData(d.GetPickListValues("RibbonTemplate__c", "State__c", false)).dt;
i = new ComboBoxItem();
i.Content = "";
cbState.Items.Add(i);
foreach (DataRow r in dt.Rows)
{
i = new ComboBoxItem();
i.Content = r["Value"].ToString();
cbState.Items.Add(i);
}
}
示例3: FillComboBox
private void FillComboBox()
{
if (TitleCB.Items.IsEmpty == true || TypeCB.Items.IsEmpty == true)
{
EmployeeController controller = new EmployeeController();
List<string> titles = controller.GetListOfTitles();
foreach (string title in titles)
{
string[] titleArray = title.Split(',');
ComboBoxItem item = new ComboBoxItem();
item.Tag = titleArray[0];
item.Content = titleArray[1];
TitleCB.Items.Add(item);
}
List<string> types = controller.GetListOfTypes();
foreach (string type in types)
{
string[] typeArray = type.Split(',');
ComboBoxItem item = new ComboBoxItem();
item.Tag = typeArray[0];
item.Content = typeArray[1];
TypeCB.Items.Add(item);
}
List<string> emails = controller.GetListOfEmails();
foreach (string email in emails)
{
ComboBoxItem item = new ComboBoxItem();
item.Content = email;
item.Tag = email;
EmailCB.Items.Add(item);
}
}
}
示例4: PreferencesWindow
public PreferencesWindow(SettingsManager manager)
{
InitializeComponent();
InitializeRegistryBoundItems();
var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Patchy.LICENSE"));
licenseText.Text = reader.ReadToEnd();
reader.Close();
Settings = manager;
DataContext = Settings;
if (Settings.EncryptionSettings == EncryptionTypes.PlainText)
encryptionSettingsComboBox.SelectedIndex = 0;
else if (Settings.EncryptionSettings == EncryptionTypes.All)
encryptionSettingsComboBox.SelectedIndex = 1;
else
encryptionSettingsComboBox.SelectedIndex = 2;
seedingTorrentDoubleClickComboBox.SelectedIndex = (int)Settings.DoubleClickSeeding;
downloadingTorrentDoubleClickComboBox.SelectedIndex = (int)Settings.DoubleClickDownloading;
foreach (var label in Settings.Labels)
{
var comboItem = new ComboBoxItem
{
Content = label.Name,
Background = label.Brush,
Foreground = label.ForegroundBrush,
Tag = label
};
rssLabelComboBox.Items.Add(comboItem);
}
}
示例5: OnEnumTypePropertyChanged
static void OnEnumTypePropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
Type enumType = e.NewValue as Type;
if (enumType != null && enumType.IsEnum) {
ComboBox comboBox = o as ComboBox;
if (comboBox != null) {
comboBox.SelectedValuePath = "Tag";
comboBox.Items.Clear();
foreach (FieldInfo field in enumType.GetFields()) {
if (field.IsStatic) {
ComboBoxItem item = new ComboBoxItem();
item.Tag = field.GetValue(null);
string description = GetDescription(field);
item.SetValueToExtension(ComboBoxItem.ContentProperty, new StringParseExtension(description));
comboBox.Items.Add(item);
}
}
}
RadioButtonGroup rbg = o as RadioButtonGroup;
if (rbg != null) {
rbg.Items.Clear();
foreach (FieldInfo field in enumType.GetFields()) {
if (field.IsStatic) {
RadioButton b = new RadioButton();
b.Tag = field.GetValue(null);
string description = GetDescription(field);
b.SetValueToExtension(RadioButton.ContentProperty, new StringParseExtension(description));
rbg.Items.Add(b);
}
}
}
}
}
示例6: QueryBySQL
public QueryBySQL()
{
InitializeComponent();
featuresLayer = MyMap.Layers[1] as FeaturesLayer;
//设置显示查询图层的下拉框
#region ComboBox
comboBox = new ComboBox();
comboBox.Width = 160;
comboBox.Height = 25;
comboBox.VerticalAlignment = VerticalAlignment.Top;
comboBox.HorizontalAlignment = HorizontalAlignment.Right;
ComboBoxItem itemPoint = new ComboBoxItem();
itemPoint.Content = PointLayerName;
ComboBoxItem itemLine = new ComboBoxItem();
itemLine.Content = LineLayerName;
ComboBoxItem itemRegion = new ComboBoxItem();
itemRegion.Content = AreaLayerName;
ComboBoxItem itemAll = new ComboBoxItem();
itemAll.Content = "全部图层";
comboBox.Items.Add(itemPoint);
comboBox.Items.Add(itemLine);
comboBox.Items.Add(itemRegion);
comboBox.Items.Add(itemAll);
MyStackPanel.Children.Add(comboBox);
comboBox.SelectedIndex = 2;
#endregion
MyTextBox.Text = "smid<10 and smid>3";
}
示例7: checkServices
private void checkServices()
{
try
{
using (var ctx = new finalContext())
{
string dept = "";
ComboBoxItem typeItem = (ComboBoxItem)cmbDept.SelectedItem;
string value = typeItem.Content.ToString();
if (value == "Both")
dept = "";
else
dept = value;
var ser = from s in ctx.Services
where s.Active == true && s.Department.Contains(dept)
select s;
cmbTOL.Items.Clear();
cmbTOL.Items.Add(new ComboBoxItem { Content = "All" });
foreach (var i in ser)
{
ComboBoxItem cb = new ComboBoxItem { Content = i.Name };
cmbTOL.Items.Add(cb);
}
}
}
catch (Exception)
{ return; }
}
示例8: AgencyFillComboBox
public static void AgencyFillComboBox(i9ComboBox AgencyComboBox, DataTable i9AgencyDataTabe)
{
if (AgencyComboBox.Items.Count <= 0)
{
AgencyComboBox.Items.Clear();
foreach (DataRow dr in i9AgencyDataTabe.Rows)
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Content = dr["AgencyName"].ToString();
cbi.Tag = dr["i9AgencyID"].ToString();
int i = AgencyComboBox.Items.Add(cbi);
}
}
if (AgencyComboBox.Items.Count > 0)
{
if (AgencyComboBox.SelectedItem == null)
{
AgencyComboBox.IsEnabled = false;
AgencyComboBox.SelectedIndex = 0;
AgencyComboBox.IsEnabled = true;
}
ComboBoxItem SelectCbi = (ComboBoxItem)AgencyComboBox.SelectedItem;
//string i9AgencyID = SelectCbi.Tag.ToString();
}
}
示例9: FicheReservation
public FicheReservation(Reservation re, Ressources r, DataGrid d)
{
rez = re;
res = r;
data = d;
InitializeComponent();
foreach (Particulier p in r.ListeClients)
{
ComboBoxItem monItem = new ComboBoxItem();
monItem.Name = "idProp" + p.Id;
monItem.Content = p.Id + " " + p.Nom + " " + p.Prenom;
IDLoc.Items.Add(monItem);
}
foreach (Logement l in r.ListeLogements)
{
ComboBoxItem monItem = new ComboBoxItem();
monItem.Name = "idlogement" + l.Id;
int taille = l.GetType().ToString().Count();
monItem.Content = l.Id + " " + l.GetType().ToString().Substring(11, taille - 11) + " " + l.Adresse.Ville;
IDLog.Items.Add(monItem);
}
IDLoc.SelectedIndex = rez.IDClient - 1;
IDLog.SelectedIndex = rez.IDLogement - 1;
calendar1.BlackoutDates.Add(new CalendarDateRange(rez.DateDebut, rez.DateDebut.AddDays(7 * rez.Duree - 1)));
calendar1.DisplayDate = rez.DateDebut;
calendar1.SelectionMode = CalendarSelectionMode.None;
}
示例10: LotSiteMaterialCostReport
public LotSiteMaterialCostReport()
{
this.Name = "LotSiteMaterialCostReport";
InitializeComponent();
builderItem = (ComboBoxItem)cmboType.SelectedItem;
LoadGrid();
}
示例11: AjoutReservation
public AjoutReservation(Ressources r, DataGrid datagridReservation)
{
InitializeComponent();
res = r;
datagridreservation = datagridReservation;
foreach (Particulier p in r.ListeClients)
{
ComboBoxItem monItem = new ComboBoxItem();
monItem.Name = "idProp" + p.Id;
monItem.Content = p.Id + " " + p.Nom + " " + p.Prenom;
IDLoc.Items.Add(monItem);
}
foreach (Logement l in r.ListeLogements)
{
ComboBoxItem monItem = new ComboBoxItem();
monItem.Name = "idlogement" + l.Id;
int taille = l.GetType().ToString().Count();
monItem.Content = l.Id + " " + l.GetType().ToString().Substring(11, taille - 11) + " " + l.Adresse.Ville;
IDLog.Items.Add(monItem);
}
for (int i = 0; i < dureeMax; i++ )
{
ComboBoxItem monItem = new ComboBoxItem();
monItem.Name = "dure" + i;
monItem.Content = i + 1;
Duree.Items.Add(monItem);
}
InitializeComponent();
}
示例12: InitializeComboBoxes
public void InitializeComboBoxes()
{
_departmentService = new DepartmentService();
_credentialsService = new CredentialsService();
_doctorService = new DoctorService();
_deptsList = _departmentService.FindAll();
_statusList = new List<string>() { "active", "inactive" };
ComboBoxItem cbm;
if (_deptsList != null)
{
foreach (Department d in _deptsList)
{
cbm = new ComboBoxItem();
cbm.Content = d.Name;
cbm.Tag = d.Id;
departmentComboBox.Items.Add(cbm);
}
}
foreach (KeyValuePair<int, string> status in DoctorStatus.DoctorStatuses)
{
cbm = new ComboBoxItem();
cbm.Content = status.Value;
cbm.Tag = status.Key;
statusComoBox.Items.Add(cbm);
}
}
示例13: MergeControl
/// <summary>
/// Constructor
/// </summary>
/// <param name="view">The view to attach</param>
/// <param name="db">The database to attach</param>
/// <param name="dashboardHelper">The dashboard helper to attach</param>
public MergeControl(DashboardHelper dashboardHelper)
{
InitializeComponent();
pnlTableOverwrite.Visibility = System.Windows.Visibility.Collapsed;
pnlError.Visibility = System.Windows.Visibility.Collapsed;
pnlProgress.Visibility = System.Windows.Visibility.Collapsed;
this.dashboardHelper = dashboardHelper;
imgClose.MouseEnter += new MouseEventHandler(imgClose_MouseEnter);
imgClose.MouseLeave += new MouseEventHandler(imgClose_MouseLeave);
imgClose.MouseDown += new MouseButtonEventHandler(imgClose_MouseDown);
cmbSourceDataFormat.Items.Clear();
this.GadgetProgressUpdate += new GadgetProgressUpdateHandler(RequestUpdateStatusMessage);
foreach (Epi.DataSets.Config.DataDriverRow row in dashboardHelper.Config.DataDrivers)
{
ComboBoxItem item = new ComboBoxItem();
item.Content = row.DisplayName;
//cmbDataFormats.Items.Add(new ComboBoxItem(row.Type, row.DisplayName, null));
cmbSourceDataFormat.Items.Add(item);
}
}
示例14: OnFieldIsSet
protected override void OnFieldIsSet()
{
base.OnFieldIsSet() ;
_container.Children.Add( _comboBox ) ;
foreach ( Option option in Field.GetOptions() )
{
ComboBoxItem comboBoxItem = new ComboBoxItem() ;
comboBoxItem.Content = option.Label ;
comboBoxItem.DataContext = option.GetValue() ;
foreach ( string text in Field.GetValues() )
{
if ( option.GetValue() == text )
{
comboBoxItem.IsSelected = true ;
break ;
}
}
_comboBox.Items.Add( comboBoxItem ) ;
}
}
示例15: UIEstimateList
/// <summary>
///
/// </summary>
public UIEstimateList()
{
InitializeComponent();
db = new SDBServiceClient();
db1 = new SDBServiceClient();
mcm = new MouseClickManager(dgEDetails, 400);
mcm.DoubleClick += new MouseButtonEventHandler(mcm_DoubleClick);
db.GetMastersCompleted += new EventHandler<GetMastersCompletedEventArgs>(db_GetMastersCompleted);
db.GetCustomersCompleted += new EventHandler<GetCustomersCompletedEventArgs>(db_GetCustomersCompleted);
db.GetEstimateCompleted += new EventHandler<GetEstimateCompletedEventArgs>(db_GetEstimateCompleted);
db.GetSupplierCompleted += new EventHandler<GetSupplierCompletedEventArgs>(db_GetSupplierCompleted);
db1.GetMastersCompleted += new EventHandler<GetMastersCompletedEventArgs>(db_GetTypeCompleted);
db.DownloadTemplateCompleted += new EventHandler<DownloadTemplateCompletedEventArgs>(db_DownloadTemplateCompleted);
db.DownloadTemplateAsync(EOrderFile);
xmlFile = new XMLFile();
ComboBoxItem cbi1 = new ComboBoxItem();
cbi1.Content = "全て";
cboExpire.Items.Add(cbi1);
ComboBoxItem cbi2 = new ComboBoxItem();
cbi2.Content = "有効";
cboExpire.Items.Add(cbi2);
ComboBoxItem cbi3 = new ComboBoxItem();
cbi3.Content = "無効";
cboExpire.Items.Add(cbi3);
}