We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ComboBox Cell selection issue

Hi ,
  I have a grid , in that I have a column of type Combobox.

            e.Style.CellType = "ComboBox";
            e.Style.DropDownStyle = GridDropDownStyle.AutoComplete;
            e.Style.DropdownEdit.ShowButton = false;
            e.Style.ItemsSource = items;
            grid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell;

My requirement : If I Click (single click) On the cell , i should be able to see the ComboBox Icon In that Cell and Cursor should  not be visible.
Only the cell should be selected. , on subsequent clicks cursor can behave as normal.

I have attached the snapshot, which shows my requirement.

Please do the needful.


Attachment: ComboBox_db35eff1.zip

1 Reply

JS Jayapradha S Syncfusion Team April 9, 2015 03:49 PM UTC

Hi Basavaraj,

Thank you for using Syncfusion products.
We have analyzed your requirement and you can achieve this by using PreviewMouseLeftButtonEvent and CurrentCellStartEditing Event as shown in the below code snippet.
Here we have disabled the cursor at first click in combobox column(CustomerID).

Code Snippet:

private MouseButtonEventArgs clickArgs = null;

void dataGrid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)

{

if (e.ClickCount == 1)

clickArgs = e;

else

clickArgs = null;

}


void dataGrid_CurrentCellStartEditing(object sender, Syncfusion.Windows.ComponentModel.SyncfusionCancelRoutedEventArgs args)

{

if (clickArgs != null)

{

this.Dispatcher.BeginInvoke(new Action(SetCursor), System.Windows.Threading.DispatcherPriority.ApplicationIdle);

}

}

private void SetCursor()

{

GridCurrentCell cc = this.dataGrid.Model.CurrencyManager.CurrentCell;

if (cc.Renderer.CurrentCellUIElement is GridCellComboBoxDropDown)

{

GridCellComboBoxDropDown combo = cc.Renderer.CurrentCellUIElement as GridCellComboBoxDropDown;

combo.IsEnabled = false;

clickArgs = null;

}
}


We have prepared a sample to achieve your requirement and please find the sample from the below location,

Sample Link: ComboBox.zip

Kindly let us know if this solution helps you.

Regards,
Jayapradha

Loader.
Live Chat Icon For mobile
Up arrow icon