From 85bf12c641e05a2edf473e9d2b917e85caf88d43 Mon Sep 17 00:00:00 2001 From: KrithikaGanesan Date: Thu, 23 Oct 2025 18:40:54 +0530 Subject: [PATCH 1/2] 985360: Updated ReadMe file of this repository --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98ac537..4f8fdfe 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ -# How-to-select-dropdown-items-in-WF-SfComboBox -This repository contains the sample that how to select the dropdown items in the WinForms SfComboBox control. +# How to Select Items Programmatically in SfComboBox +This repository provides a detailed example of how to select items programmatically in the WinForms SfComboBox control, which is part of the Syncfusion suite. The SfComboBox control allows users to select multiple items from a dropdown list, and in certain scenarios, you may need to select items dynamically through code rather than user interaction. This is particularly useful when implementing features like loading saved preferences, applying default selections, or responding to specific application logic. + +The items can be selected programmatically using the CheckedItems property of the DropDownListView. By iterating through the items collection, you can add items to the checked list, ensuring they appear selected in the dropdown. This approach provides flexibility and control over the selection process without requiring manual input. + +For more details, refer to the official Syncfusion Knowledge Base article: +[How to select DropDown items in SfComboBox](https://wwwnforms-sfcombobox-dropdown-items-programmatically) + +## Code Example (C#) +```csharp +foreach (var selectedItems in this.sfComboBox1.DropDownListView.View.Items.ToList()) +{ + // Programmatically add the checked items + this.sfComboBox1.DropDownListView.CheckedItems.Add(selectedItems); +} From 506b8ab676fbbc105ee672c7417d71c5fc5a177e Mon Sep 17 00:00:00 2001 From: KrithikaGanesan Date: Thu, 23 Oct 2025 18:44:49 +0530 Subject: [PATCH 2/2] 985360: Updated ReadMe file of this repository --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f8fdfe..6ffdca5 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,6 @@ This repository provides a detailed example of how to select items programmatica The items can be selected programmatically using the CheckedItems property of the DropDownListView. By iterating through the items collection, you can add items to the checked list, ensuring they appear selected in the dropdown. This approach provides flexibility and control over the selection process without requiring manual input. -For more details, refer to the official Syncfusion Knowledge Base article: -[How to select DropDown items in SfComboBox](https://wwwnforms-sfcombobox-dropdown-items-programmatically) - ## Code Example (C#) ```csharp foreach (var selectedItems in this.sfComboBox1.DropDownListView.View.Items.ToList()) @@ -13,3 +10,8 @@ foreach (var selectedItems in this.sfComboBox1.DropDownListView.View.Items.ToLis // Programmatically add the checked items this.sfComboBox1.DropDownListView.CheckedItems.Add(selectedItems); } +``` + +## Reference +For more details, refer to the official Syncfusion Knowledge Base article: +[How to select DropDown items in SfComboBox](https://wwwnforms-sfcombobox-dropdown-items-programmatically)