Hi,
I am using XamDataGrid and DataPresenterExcelExporter which is exporting my fields to Excel fine except for my unbound field which is coming up with blank values. Can you please advise?
This is my code snippet:
<ipdg:Field BindingType="Unbound" Label="Cust All-In Price" Visibility="Collapsed"> <ipdg:Field.Settings> <ipdg:FieldSettings Width="Auto" CellValuePresenterStyle="{StaticResource BidAskCell}" AllowRecordFiltering="False" LabelClickAction="Nothing"/> </ipdg:Field.Settings> </ipdg:Field>
Thanks.
Hello,
Thank you for choosing Infragistics.
I have been looking into your issue and I have prepared a sample application for you to test. Please note that I was not able to reproduce the issue you have described.
Would you please provide me with more detailed information in regards to the setting of the Visibility property of the Field and the style you have used for the CellValuePresenter? Would you also please modify the sample application I have attached so the issue is reproduced and send it back to me? Having this information would help me further investigate this matter for you.
Looking forward to your reply.
Thank you for your reply. This is the BidAskCell style for the CellValuePresenter:
<Style x:Key="BidAskCell" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}" >
<StackPanel x:Name="stackPanel" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Name="BidRate" Foreground="{StaticResource ForegroundBrush}" Margin="0" Padding="0">
<TextBlock Text="{Binding Path=Record.DataItem.NearLegPriceInCuBid, RelativeSource={RelativeSource TemplatedParent}}"/>
</Label>
<TextBlock Name="Slash" Text=" / " VerticalAlignment="Center" Foreground="{StaticResource PriceMinorDigitsForeground}" />
<Label Name="AskRate" Foreground="{StaticResource ForegroundBrush}" Margin="0" Padding="0">
<TextBlock Text="{Binding Path=Record.DataItem.NearLegPriceInCuAsk, RelativeSource={RelativeSource TemplatedParent}}"/>
</StackPanel>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=DataItem.NearLegPriceInCuAsk}" Value="{x:Null}">
<Setter TargetName="Slash" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="AskRate" Property="Visibility" Value="Collapsed"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Path=DataItem.NearLegPriceInCuBid}" Value="{x:Null}">
<Setter TargetName="BidRate" Property="Visibility" Value="Collapsed"></Setter>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This is the difference between the code you sent me and my code. I don't do the assignment in C#. On the C# side, I only have:
var exporter = (DataPresenterExcelExporter) Resources["Exporter"]; exporter.Export(TradeGrid, fileName, WorkbookFormat.Excel2007);
The visibility is initially set as Collapsed but then the user can go in the Field Chooser and select the column to be displayed. When I export to Excel, there is a column called "Cust All-In Price" but the values are all empty.
Let me know if you require more information.
Thank you.