Hi
I want to have the ability to selected x number of cells then edit the value in the first cell and update the other cells with that value.
I have seen it done but with the winforms, Please Help
/Thomas
Hello Thomas,
By design, if multiple cells are selected and user clicks on one of them, in order to enter edit mode, selection is cleared.
In order to maintain selection, while a cell is in edit mode, you have to manually re-select the cell after edit mode has started. This could be achieved by handling the EditModeStarting event on the XamDataGrid and re-setting the Cell.IsSelected property to the previously selected cells. This means that you need to keep track of what cells were selected.
After the cell value is changed, in the EditModeEnded event handler, the new value could be set and get as value to the other selected cells. Keep in mind that these changes would be visible when the focus of the edited cell is lost.
I have attached a sample application that uses this approach. Please test it on your side and let me know if I may be of any further assistance.
Grid is like this and I when try to select multiple cell the first cell just getting unselected when the second is selected.
<igWPF:XamDataGrid x:Name="mediePlaner" SelectedItemsChanged="mediePlaner_SelectedItemsChanged" EditModeEnded="mediePlaner_EditModeEnded" EditModeStarting="mediePlaner_EditModeStarting" Margin="30,100,0.031,0" Grid.Row="7" VerticalAlignment="Top" Height="455" Grid.RowSpan="3" BindToSampleData="False" Grid.ColumnSpan="13" AutoFit="true" Width="Auto" PreviewMouseLeftButtonUp="mediePlaner_PreviewMouseLeftButtonUp">
<igWPF:XamDataGrid.ViewSettings> <igWPF:GridViewSettings AllowLastRecordScrollToTop="True"/> </igWPF:XamDataGrid.ViewSettings>
<igWPF:XamDataGrid.FieldSettings > <igWPF:FieldSettings AllowEdit="true" AllowGroupBy="true" AllowFixing="NearOrFar" AllowCrossFieldRecordFiltering="true" CellContentAlignment="LabelBelowValueAlignRight" AllowRecordFiltering="true" CellClickAction="SelectCell" />
</igWPF:XamDataGrid.FieldSettings>
<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout>
<igWPF:FieldLayout.SummaryDefinitions>
<igWPF:SummaryDefinition Key="unitprice_average" SourceFieldName="totalPris" Calculator="Sum" /> </igWPF:FieldLayout.SummaryDefinitions> <igWPF:FieldLayout.Settings> <igWPF:FieldLayoutSettings AutoGenerateFields="false" />
</igWPF:FieldLayout.Settings> <igWPF:TextField HorizontalContentAlignment="Left" Name="Navn" Label="Ugeavis titel" /> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="MmPris" Label="MmPris" Visibility="Visible" Format="####.##"/> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="OldMmtotal" Label="Mm Rabat" Visibility="Collapsed" Format="NO" TextAlignment="Right" /> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="MmRabat" Label="Mm Rabat" Visibility="Visible" Format="NO" AllowEdit="true" /> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="MmTotal" Label="Mm Total" Visibility="Visible" Format="NO" />
<igWPF:TextField Name="Farve4Max" Label="Farve Max" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="Farve4Min" Label="Farve Min" Visibility="Collapsed" Format="NO"/>
<igWPF:TextField Name="FarveMax" Label="FarveMax" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="FarveMin" Label="FarveMin" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="FarvePris" Label="Farve Pris" HorizontalContentAlignment="Right" Visibility="Visible" Format="NO" /> <igWPF:TextField Name="FormatFra" Label="FormatFra" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="FormatTil" Label="FormatTil" Visibility="Collapsed" Format="NO"/>
<igWPF:NumericField Name="MiljøTillæg" Label="MiljøTillæg" Visibility="Collapsed" Format="NO" ></igWPF:NumericField> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="FarveRabat" Label="Farve Rabat" Visibility="Visible" Format="NO"/> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="FarveTotal" Label="Farve Total" Visibility="Visible" Format="NO" />
<igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="totalPris" Label="Total" Visibility="Visible" Format="NO" /> <igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="TotalIncltillæg" Label="Total Incl Tillæg" Visibility="Collapsed" Format="NO" />
<igWPF:TextField LabelTextAlignment="Right" HorizontalContentAlignment="Right" Name="bemærkning" Label="bemærkning" Visibility="Visible" Format="NO" />
<igWPF:TextField Name="Adresse" Label="Adresse" Visibility="Collapsed" Format="NO"/> <igWPF:TextField Name="Adresse2" Label="Adresse2" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="AnnonceEmail" Label="AnnonceEmail" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="AnnonceKontrolEmail" Label="AnnonceKontrolEmail" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="BilagsbladeEmail" Label="BilagsbladeEmail" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="BladID" Label="BladID" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="BogholderiEmails" Label="BogholderiEmails" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="CVR" Label="CVR" Visibility="Collapsed" Format="NO" /> <igWPF:TextField Name="DiMPDelOmraadeKode" Label="DiMPDelOmraadeKode" Visibility="Collapsed" /> <igWPF:TextField Name="Ejerforhold" Label="Ejerforhold" Visibility="Collapsed" /> <igWPF:TextField Name="Emails" Label="Emails" Visibility="Collapsed"/> <igWPF:TextField Name="FakturaGruppeID" Label="FakturaGruppeID" Visibility="Collapsed"/> <igWPF:TextField Name="Fax" Label="Fax" Visibility="Collapsed" /> <igWPF:TextField Name="Format" Label="Format" Visibility="Collapsed" /> <igWPF:CheckBoxField Name="GiverWebTillaeg" Label="GiverWebTillaeg" Visibility="Collapsed"/> <igWPF:TextField Name="GruppeRabat" Label="GruppeRabat" Visibility="Collapsed" /> <igWPF:TextField Name="Hjemmeside" Label="Hjemmeside" Visibility="Collapsed" /> <igWPF:TextField Name="Koncern" Label="Koncern" Visibility="Collapsed"/> <igWPF:TextField Name="Kontaktperson" Label="Kontaktperson" Visibility="Collapsed"/> <igWPF:TextField Name="KontaktpersonerEmails" Label="KontaktpersonerEmails" Visibility="Collapsed"/> <igWPF:TextField Name="MaterialedeadlineRubrik" Label="MaterialedeadlineRubrik" Visibility="Collapsed" /> <igWPF:TextField Name="MaterialeDeadlineRubrikDag" Label="MaterialeDeadlineRubrikDag" Visibility="Collapsed" /> <igWPF:TextField Name="MaterialeDeadlineRubrikKl" Label="MaterialeDeadlineRubrikKl" Visibility="Collapsed" /> <igWPF:TextField Name="MaterialedeadlineTekst" Label="MaterialedeadlineTekst" Visibility="Collapsed" /> <igWPF:TextField Name="MaterialeDeadlineTekstDag" Label="MaterialeDeadlineTekstDag" Visibility="Collapsed"/> <igWPF:TextField Name="MaterialeDeadlineTekstKl" Label="MaterialeDeadlineTekstKl" Visibility="Collapsed" /> <igWPF:TextField Name="MaterialeEmail" Label="MaterialeEmail" Visibility="Collapsed"/> <igWPF:TextField Name="MatGodtBeloeb" Label="MatGodtBeloeb" Visibility="Collapsed" /> <igWPF:TextField Name="MedlemMaaned" Label="MedlemMaaned" Visibility="Collapsed"/> <igWPF:TextField Name="Medlemaar" Label="Medlemaar" Visibility="Collapsed"/> <igWPF:CheckBoxField Name="MaaGiveFarveRabat" Label="MaaGiveFarveRabat" Visibility="Collapsed"/>
<igWPF:TextField Name="Navn2" Label="Navn2" Visibility="Collapsed" /> <igWPF:CheckBoxField Name="Ophoert" Label="Ophoert" Visibility="Collapsed" /> <igWPF:TextField Name="OrdrecheckEmail" Label="OrdrecheckEmail" Visibility="Collapsed" /> <igWPF:TextField Name="OrdrecheckSendeDagID" Label="OrdrecheckSendeDagID" Visibility="Collapsed"/> <igWPF:TextField Name="OrdredeadlineRubrik" Label="OrdredeadlineRubrik" Visibility="Collapsed"/> <igWPF:TextField Name="OrdreDeadlineRubrikDag" Label="OrdreDeadlineRubrikDag" Visibility="Collapsed"/> <igWPF:TextField Name="OrdreDeadlineRubrikKl" Label="OrdreDeadlineRubrikKl" Visibility="Collapsed" /> <igWPF:TextField Name="OrdredeadlineTekst" Label="OrdredeadlineTekst" Visibility="Collapsed" /> <igWPF:TextField Name="OrdreDeadlineTekstDag" Label="OrdreDeadlineTekstDag" Visibility="Collapsed" /> <igWPF:TextField Name="OrdreDeadlineTekstKl" Label="OrdreDeadlineTekstKl" Visibility="Collapsed" /> <igWPF:TextField Name="OrdreEmail" Label="OrdreEmail" Visibility="Collapsed"/> <igWPF:TextField Name="OrienteringEmails" Label="OrienteringEmails" Visibility="Collapsed" /> <igWPF:CheckBoxField Name="Overfoert" Label="Overfoert" Visibility="Collapsed"/> <igWPF:TextField Name="Primaer" Label="Primaer" Visibility="Collapsed"/> <igWPF:TextField Name="PrimaerPct" Label="PrimaerPct" Visibility="Collapsed"/> <igWPF:TextField Name="PrisforespoergselEmails" Label="PrisforespoergselEmails" Visibility="Collapsed"/> <igWPF:TextField Name="RedaktionEmail" Label="RedaktionEmail" Visibility="Collapsed"/> <igWPF:TextField Name="SamannonceringsRabat" Label="SamannonceringsRabat" Visibility="Collapsed"/> <igWPF:TextField Name="SendetidOrdrecheck" Label="SendetidOrdrecheck" Visibility="Collapsed" /> <igWPF:CheckBoxField Name="SendIndevaerendeUge" Label="SendIndevaerendeUge" Visibility="Collapsed"/> <igWPF:TextField Name="StamdataEmail" Label="StamdataEmail" Visibility="Collapsed" /> <igWPF:TextField Name="Tlf" Label="Tlf" Visibility="Collapsed" /> <igWPF:TextField Name="Totalomraade" Label="Totalomraade" Visibility="Collapsed" /> <igWPF:TextField Name="TotalomraadePct" Label="TotalomraadePct" Visibility="Collapsed"/> <igWPF:CheckBoxField Name="VisPaaWWW" Label="VisPaaWWW" Visibility="Collapsed"/>
<igWPF:TextField Name="RegionNavn" Label="Region Navn" Visibility="Collapsed" /> <igWPF:TextField Name="DaekningsGrad" Label="Dæknings Grad" Visibility="Collapsed"/> <igWPF:TextField Name="Oplag" Label="Oplag" Visibility="Collapsed" /> <igWPF:TextField Name="DagNavn" Label="DagNavn" Visibility="Collapsed" /> <igWPF:TextField Name="GeoKodeNavn" Label="GeoKodeNavn" Visibility="Collapsed" /> <igWPF:TextField Name="HovedGruppeNavn" Label="HovedGruppeNavn" Visibility="Collapsed" /> <igWPF:TextField Name="Husstande" Label="Husstande" Visibility="Collapsed" /> <igWPF:TextField Name="MaxDaekningsGrad" Label="MaxDaekningsGrad" Visibility="Collapsed" /> <igWPF:TextField Name="PostBy" Label="PostBy" Visibility="Collapsed"/> <igWPF:TextField Name="PostNr" Label="PostBy" Visibility="Collapsed"/> <igWPF:TextField Name="Betegnelse" Label="Betegnelse" Visibility="Collapsed"/> <igWPF:TextField Name="PrislisteNavn" Label="PrislisteNavn" Visibility="Collapsed" />
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>
<igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:FieldLayoutSettings HeaderPrefixAreaDisplayMode="Menu" HeaderPrefixAreaMenuOptions="Default" FilterUIType="Default"/> </igWPF:XamDataGrid.FieldLayoutSettings> </igWPF:XamDataGrid>