Articles in this section
Category / Section

How to open DropDown Popup of the GridMultiColumnDropDownList while entering the text in WPF DataGrid?

3 mins read

In WPF DataGrid (SfDataGrid), the WPF MultiColumnDropDownControl (SfMultiColumnDropDownControl) is loaded as a UIElement in the edit mode for GridMultiColumnDropDownList. The popup of the GridMultiColumnDropDownList column is opened by clicking the drop-down icon of that column, by default. 


You can also open the Popup while entering the text in the corresponding cell that gets into the edit mode by enabling the 
AllowImmediatePopup and IsDropDownOpen properties. For this, you need to derive a new class from the GridCellMultiColumnDropDownRenderer and override its OnEditElementLoaded virtual method. 

public class GridCellMultiColumnDropDownRendererExt : GridCellMultiColumnDropDownRenderer
{
    protected override void OnEditElementLoaded(object sender, RoutedEventArgs e)
    {      
        //Enables the AllowImmediatePopup and IsDropDownOpen when set to true.             
        (sender as SfMultiColumnDropDownControl).AllowImmediatePopup = true;            
        (sender as SfMultiColumnDropDownControl).IsDropDownOpen = true;
 
        //Assigns the input text to the SfMultiColumnDropDownControl's text property.
        (sender as SfMultiColumnDropDownControl).Text = PreviewInputText;
        base.OnEditElementLoaded(sender, e);
    }              
}

Note: The above code is only applicable for the WPF platform. For WinRT, refer to the attached sample.

 

Refer to the following code example to remove the default GridCellMultiColumnDropDownRenderer and add the above customized GridCellMultiColumnDropDownRendererExt to the renderer’s collection in the DataGrid.

public MainWindow()
{
    InitializeComponent();
    // Adds Custom MultiColumnDropDown renderer to the CellRenderers. 
    this.grid.CellRenderers.Remove("MultiColumnDropDown");
    this.grid.CellRenderers.Add("MultiColumnDropDown", new GridCellMultiColumnDropDownRendererExt());
}

Sample Links:

 WPF

 WinRT

 

Conclusion

I hope you enjoyed learning about how to open DropDown Popup of the GridMultiColumnDropDownList while entering the text.

You can refer to our WPF DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF DataGrid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied