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
800
forcing selection
posted

I am  deleting selected records in response to the delete key. The records are being removed from my VM and the grid is refreshing just fine.

Then I execute:

xamDataGrid1.ExecuteCommand(DataPresenterCommands.RecordFirstOverall);

to set a new selection. The problem is this record is not selected. Is it just what you call Active. If I iterate the selected cells there are none selected.

In addition, if I use the arrow keys to nav around the grid those records do not become selected.It seems that the selection vs active feature is kind of confusing as far as UI. E.g. to the user the items appear selected (because they are highlighted) so a command on them should execute.

So my questions are:

Is there a way to force the grid to always have selected cells, basically remove the Active cell feature?

Is there a way to iterate the active  cells or records?

Or just a general workaround for this highlighting issue.

 

  • 69686
    posted

    Hello,

    The RecordFirstOverall command will activete the first record in the XamDataGrid. It will not make it selected. If you want to select it, there are couple of options that you can do that :

    1. You can create your own command that will bring the first record into view (BringRecordIntoView() method) and will select it

    2. You can handle the ExecutedCommand event of the XDG and check if the command executed was RecordFirstOverall and select the active record.

    Regarding your other questions - the XDG can have only one active record. Thus you cannot iterate through active records, but you can iterate through its cells. For this, the active record must be a DataRecord, as the DataRecord exposes the Cells collection.