Good Afternoon,
I am using the FieldChooser and i set the property ExpansionIndicatorDisplayMode="Never".
But when i export to excel the FieldChooser back to show the tables of ForeignKey.
Can someone help me?
Thank you.
Hello,
It seems that you are having an issue with the FieldGroupSelectorVisibility property of the FieldChooser,correct? I was not able to reproduce this. The excel exporting has to relation to the FieldChooser. Can you please provide us with a sample that demonstrates this issue?
My XamDataGrid - XAML :
<my:XamDataGrid vm:ControlBehaviours.DoubleClickCommand="{Binding CommandEditUserGroups}" IsSynchronizedWithCurrentItem="True" Margin="0,46,0,0" Name="DataGrid" Theme="Generic" AllowDrop="False" GroupByAreaLocation="AboveDataArea" DataSource="{Binding UserGroupsCollectionView,Mode=TwoWay}" GroupByAreaMode="MultipleFieldLayoutsFull" Background="White" Foreground="White" ActiveRecord="{Binding Path=ItemCurrent,Mode=TwoWay}"> <my:XamDataGrid.FieldLayouts> <my:FieldLayout Description="UserGroups" > <my:Field Name="BranchID" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="ID" Label="Código" /> <my:Field Name="Name" Label="Nome" /> <my:Field Name="Remarks" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="Error" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="CreatedByUser" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="CreatedDate" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="UserLastChange" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> <my:Field Name="DateLastChange" Visibility="Collapsed"> <my:Field.Settings> <my:FieldSettings AllowHiding="Never"/> </my:Field.Settings> </my:Field> </my:FieldLayout> </my:XamDataGrid.FieldLayouts> <my:XamDataGrid.FieldSettings> <my:FieldSettings AllowRecordFiltering="True" AllowSummaries="True" AllowEdit="False" SummaryUIType="MultiSelect" FilterOperandUIType="Default" FilterClearButtonVisibility="Visible" AutoSizeOptions="All" CellClickAction="SelectRecord" DataValueChangedScope="Default" /> </my:XamDataGrid.FieldSettings> <my:XamDataGrid.FieldLayoutSettings> <my:FieldLayoutSettings ExpansionIndicatorDisplayMode="Never" AllowFieldMoving="WithinLogicalRow" AllowAddNew="False" AllowDelete="False" SelectionTypeRecord="Single" AutoGenerateFields="True" MaxSelectedRecords="1" HighlightAlternateRecords="True" HeaderPrefixAreaDisplayMode="FieldChooserButton" HeaderPlacement="OnTopOnly" HeaderPlacementInGroupBy="OnTopOnly"> </my:FieldLayoutSettings> </my:XamDataGrid.FieldLayoutSettings> <my:XamDataGrid.GroupByAreaMulti> <my:GroupByAreaMulti Foreground="Black" Prompt1="" Prompt2="Clique e Arraste uma coluna para agrupar." IsExpanded="True"/> </my:XamDataGrid.GroupByAreaMulti> </my:XamDataGrid>
CodeBehind ExcelExporter :
public static void ExportExcel(XamDataGrid DataGrid) { string FileNameComplete = System.IO.Path.GetTempFileName() + ".xls"; ; DataPresenterExcelExporter ExcelExporte = new DataPresenterExcelExporter(); ExportOptions Options = new ExportOptions(); FormatSettings Format = new FormatSettings() { FillPattern = FillPatternStyle.Solid, FillPatternBackgroundColor = Colors.Black, FillPatternForegroundColor = Colors.LightBlue }; DataPresenterExcelExporter.SetExcelLabelFormatSettings(DataGrid.FieldSettings, Format); ExcelExporte.Export(DataGrid, FileNameComplete, WorkbookFormat.Excel97To2003, Options); System.Diagnostics.Process OpenExcel = new System.Diagnostics.Process(); OpenExcel.StartInfo.FileName = FileNameComplete; OpenExcel.Start(); }
Thanks