Skip to content

Commit 6dc3fe0

Browse files
author
Manivannan
committed
Rebase the main branch.
1 parent 7381768 commit 6dc3fe0

File tree

2 files changed

+74
-12
lines changed

2 files changed

+74
-12
lines changed

.github/workflows/gitleaks.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Secret Value found!
1+
name: Secret Value found!!
22
on:
33
push:
44
public:
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install the report tool packages
3333
if: steps.gitleaks.outcome != 'success'
3434
run: |
35-
nuget install "Syncfusion.Email" -source "https://nexus.syncfusion.com/repository/nuget-hosted/"
36-
dir $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1
37-
dotnet $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1/Email.dll "citeam@syncfusion.com" "$GITHUB_REF_NAME" ${{ secrets.NETWORKCREDENTIALS }} ${{ secrets.NETWORKKEY }} "$GITHUB_WORKSPACE"
38-
exit 1
35+
nuget install "Syncfusion.Email" -source ${{ secrets.NexusFeedLink }} -ExcludeVersion
36+
dir $GITHUB_WORKSPACE/Syncfusion.Email/lib/netcoreapp3.1
37+
dotnet $GITHUB_WORKSPACE/Syncfusion.Email/lib/netcoreapp3.1/GitleaksReportMail.dll ${{ secrets.CITEAMCREDENTIALS }} "$GITHUB_REF_NAME" ${{ secrets.NETWORKCREDENTIALS }} ${{ secrets.NETWORKKEY }} "$GITHUB_WORKSPACE" ${{ secrets.ORGANIZATIONNAME }}
38+
exit 1

README.md

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
1-
# How to select item programatically in SfComboBox.
2-
The items can be selected programmatically using the checked items property. For more details please refer [How to select DropDown items in SfComboBox](https://www.syncfusion.com/kb/12155/how-to-select-the-winforms-sfcombobox-dropdown-items-programmatically).
1+
# How to Select Items Programmatically in SfComboBox
2+
This example demonstrates how to select items programmatically in the Syncfusion WinForms SfComboBox control. The SfComboBox supports multi-selection, making it useful for scenarios where you need to select items dynamically through code rather than user interaction. This is particularly helpful for:
3+
- Loading saved preferences.
4+
- Applying default selections.
5+
- Responding to application logic.
36

4-
# C#
5-
foreach (var selectedItems in this.sfComboBox1.DropDownListView.View.Items.ToList())
7+
## Why This Is Useful
8+
- **Dynamic Selection**: Automatically select items based on conditions.
9+
- **Improved UX**: Pre-load user preferences or defaults.
10+
- **Flexibility**: Control selection without manual input.
11+
12+
## Key Approach
13+
Use the CheckedItems property of the DropDownListView to programmatically select items. By iterating through the items collection, you can add items to the checked list, ensuring they appear selected in the dropdown.
14+
15+
## Code Example
16+
17+
```C#
18+
private void InitializeComponent()
19+
{
20+
this.sfComboBox1 = new Syncfusion.WinForms.ListView.SfComboBox();
21+
((System.ComponentModel.ISupportInitialize)(this.sfComboBox1)).BeginInit();
22+
this.SuspendLayout();
23+
24+
// sfComboBox1
25+
this.sfComboBox1.ComboBoxMode = Syncfusion.WinForms.ListView.Enums.ComboBoxMode.MultiSelection;
26+
this.sfComboBox1.Location = new System.Drawing.Point(167, 76);
27+
this.sfComboBox1.Name = "sfComboBox1";
28+
this.sfComboBox1.Size = new System.Drawing.Size(171, 37);
29+
this.sfComboBox1.TabIndex = 0;
30+
31+
// Form1
32+
this.ClientSize = new System.Drawing.Size(535, 294);
33+
this.Controls.Add(this.sfComboBox1);
34+
this.StartPosition = FormStartPosition.CenterScreen;
35+
this.Text = "SfComboBox_Selection";
36+
37+
((System.ComponentModel.ISupportInitialize)(this.sfComboBox1)).EndInit();
38+
this.ResumeLayout(false);
39+
}
40+
41+
public Form1()
42+
{
43+
// Bind data source
44+
sfComboBox1.DataSource = GetTable();
45+
sfComboBox1.DisplayMember = "Patient";
46+
sfComboBox1.ValueMember = "Drug";
47+
48+
// Programmatically select all items
49+
foreach (var item in sfComboBox1.DropDownListView.View.Items.ToList())
650
{
7-
//Programmatically add the checked items
8-
this.sfComboBox1.DropDownListView.CheckedItems.Add(selectedItems);
51+
sfComboBox1.DropDownListView.CheckedItems.Add(item);
952
}
53+
}
54+
55+
private DataTable GetTable()
56+
{
57+
DataTable table = new DataTable();
58+
table.Columns.Add("Dosage", typeof(int));
59+
table.Columns.Add("Drug", typeof(string));
60+
table.Columns.Add("Patient", typeof(string));
61+
62+
table.Rows.Add(25, "Indocin", "David");
63+
table.Rows.Add(50, "Enebrel", "Sam");
64+
table.Rows.Add(10, "Hydralazine", "Christoff");
65+
table.Rows.Add(21, "Combivent", "Janet");
66+
table.Rows.Add(100, "Dilantin", "Melanie");
67+
68+
return table;
69+
}
70+
```
1071

11-
![Programtically select DropDown items](SfComboBox_Select_Dropdownitems/Images/Select%20DropDown%20Items.png)
72+
## Reference
73+
For more details, refer to the official Syncfusion Knowledge Base article: [How to select DropDown items in SfComboBox](https://wwwnforms-sfcombobox-dropdown-items-programmatically)

0 commit comments

Comments
 (0)