Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
430
Fire SelectedItemsChanged event only when user selects row
posted

Hi,

In my xamdatagrid, I want to fire  SelectedItemsChanged event only when user selects row with pressing arrows.

But It also fires event when user presses the arrow of a xamcombo in a cell. In the fired event I can control if active cell is null then do nothing.

But in UI when selecting combox it shows user the new selected row is the row of combobox. 

I do not want to change selected row when user clicks a cell in another row.

So How can I get this behaviour?

HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectedItemsChanged="calismaProgramGrid_SelectedItemsChanged" >


LabelTextAlignment="Center" AllowLabelVirtualization="True" LabelTextTrimming="None"
FilterOperatorDefaultValue="Contains"/>


HeaderPrefixAreaDisplayMode="FieldChooserButton" DataRecordSizingMode="SizedToContentAndIndividuallySizable"
AllowClipboardOperations="Copy" AutoGenerateFields="False">

Fired event in the below

private void calismaProgramGrid_SelectedItemsChanged(object sender, Infragistics.Windows.DataPresenter.Events.SelectedItemsChangedEventArgs e)
{
int kId;

XamDataGrid senderGrid = (sender as XamDataGrid);
Cell activeCell = senderGrid.ActiveCell;
if (activeCell == null && senderGrid.ActiveRecord != null)

{
DataRecord selectedRecord = (DataRecord)this.calismaProgramGrid.ActiveRecord;
if (selectedRecord != null)
{
CellCollection cells = selectedRecord.Cells;
Cell incTCell = cells.FirstOrDefault(c => c.Field.Name == "KontrolMaddeId");
DenetimCalismaProgrami drv = (DenetimCalismaProgrami)incTCell.Record.DataItem;

if (drv != null)
{
//bla bla
}

}}
}

  • 138253
    Verified Answer
    Offline posted

    Hello,

    Thank you for your post. I have been looking into it and I can suggest you add the following check in the XamDataGrid’s SelectedItemsChanged event handler:

    if (e.Type == typeof(DataRecord))
    {
     
    }

     

    This way you will be able to determine when the RecordSelector has been clicked. Please let me know if you need further clarification on this matter.

    Looking forward for your reply.