Hello,
I was searching trough the forum to see, if this question has already been asked: How can I limited the number of selected rows to 1, but allow the the selection of multiple cells in the same row.
The postings I found so far adress slightly different aspects.
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/123325/xamdatagrid-select-all-rows-select-one-row/541628#541628
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/40971/how-to-restrict-only-one-row-to-be-selected-in-a-xamdatagrid
Each row represents a different construction site. In this scenario it does not make sense to edit the data of multiple rows at the same time. But the editing of multiple cells of the same row should be possible (copy, paste, etc.)
In the best case the selection and also dragging would be possible only on the horizontal axes.
Is there a way to achieve that?
Thanks
Niko
Hello Niko,
Thank you for your post.
The Drag & Drop framework relies on mouse events, however as you have said that the cellValuePresener has been re-styled. If you have re-templated it and some of these events are not firing, it is possible to have that to be the issue here.
I'd suggest to start looking there to see if some events are eaten. With the setup from my previous e-mail, you should be able to select multiple cells and up to 1 record while dragging.
Also, I can suggest using template fields rather than restyling CVP as alternative.
Please let me know if any of the suggestion above are applicable in your case.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
Hello Tihomir,
unfortunatly I cannot confim this behavior.
Maybe there is something in my XAML that prevents that.
Some input:
1. There are a number of styles (e.g. CellValuePresenter, RecordListControl, DataRecordArea, DataRecordPresenter) that might impact the behavior
2. The best case scenario is that cell selection can only be done in the same record like a swimlane
3. The cells that can be selected have a CellValuePresenter that has an own view class in the DatatTemplate to draw the content
4. You can see the setings of the XamDatagrid below
I you have some pointers where I should start look they are very welcome.
<igWPF:XamDataGrid Name="Auslastungsplanung" Grid.Column="0" DataSource="{Binding AuslastungsBaustellen, UpdateSourceTrigger=PropertyChanged}" SelectedDataItemsScope="RecordsOrCells" GroupByAreaLocation="None" IsSynchronizedWithCurrentItem="True" IsUndoEnabled="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FieldLayoutInitialized="AddCustomColumnsBaustellen" InitializeRecord="RefreshSorting" Grid.Row="0" SelectedDataItems="{Binding SelectedItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextInput="Auslastungsplanung_TextInput" SelectedItemsChanging="XamDataGrid_SelectedItemsChanging" RecordContainerGenerationMode="Recycle" CellContainerGenerationMode="Recycle" SelectedDataItem="{Binding CurrentBaustelle, UpdateSourceTrigger=PropertyChanged}" ScrollingMode="Immediate" AllowDrop="True" > <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="False" AllowDelete="False" AutoFitMode="Never" RecordSelectorLocation="None" SelectionTypeCell="ExtendedAutoDrag" RecordFilterScope="AllRecords" ExpansionIndicatorDisplayMode="CheckOnDisplay" SelectionTypeRecord="Single" SelectionTypeField="Extended" FilterEvaluationMode="Auto" MaxSelectedRecords="1" AllowClipboardOperations="All" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings CellClickAction="SelectCell" AllowRecordFiltering="True" AllowGroupBy="False" FilterStringComparisonType="CaseInsensitive" FilterOperatorDefaultValue="Contains" FilterOperandUIType="ExcelStyle" FilterOperatorDropDownItems="None" FilterClearButtonVisibility="Collapsed" LabelTextAlignment="Center" LabelTextWrapping="Wrap" LabelClickAction="SortByMultipleFieldsTriState" AllowEdit="False" AllowCellVirtualization="True" ForceCellVirtualization="True" AllowLabelVirtualization="True"/> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.ViewSettings> <igDP:GridViewSettings UseNestedPanels="True" /> </igDP:XamDataGrid.ViewSettings>
Thank you for posting on our forums.
As per the forums posts you have posted:
SelectionTypeRecord="Single"
will limit the number of selected records.
In order to select multiple cells, you should also set the following property of FieldLayoutSettings:
SelectionTypeCell="ExtendedAutoDrag"
as well as
CellClickAction="SelectCell"
of FieldSettings.
<igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings CellClickAction="SelectCell"/> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings SelectionTypeRecord="Single" SelectionTypeCell="ExtendedAutoDrag"> </igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings>
Should you have any further questions, please let me know.