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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ComboBox Cell selection issue

Thread ID:

Created:

Updated:

Platform:

Replies:

118760 Apr 8,2015 07:48 AM UTC Apr 9,2015 03:49 PM UTC WPF 1
loading
Tags: GridDataControl
Basavaraj Angadi
Asked On April 8, 2015 07:48 AM UTC

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

Jayapradha S [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;