Articles in this section
Category / Section

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

3 mins read

The SfMultiColumnDropDownControl is loaded as a UIElement in the edit mode for the 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 SfMultiColumnDropDownControl.AllowImmediatePopup and SfMultiColumnDropDownControl.IsDropDownOpen properties. For this, you need to derive a new class from the GridCellMultiColumnDropDownRenderer and override its OnEditElementLoaded virtual method. This is demonstrated in the following code example.

C#

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 SfDataGrid.

C#

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: http://www.syncfusion.com/downloads/support/directtrac/138081/ze/WPF-1357245885

WinRT: http://www.syncfusion.com/downloads/support/directtrac/138081/ze/WinRT-481668761

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