Hello,
I have a xamDataGrid with one header, one fixed field and others are dynamic.
I add these lines to support copy\paste :
AllowClipboardOperations="Copy" CopyFieldLabelsToClipboard="True"
My code :
<dataPresenter:XamDataGrid.FieldLayouts> <dataPresenter:FieldLayout> <dataPresenter:UnboundField x:Name="Header" Column="2" Label="Azimuth" Row="0"> <dataPresenter:UnboundField.Settings> <dataPresenter:FieldSettings CellContentAlignment="LabelOnly" LabelTextAlignment="Center" /> </dataPresenter:UnboundField.Settings> </dataPresenter:UnboundField>
<dataPresenter:Field Name="A" Width="100" Column="0" Row="0" RowSpan="2"> <dataPresenter:Field.Settings> <dataPresenter:FieldSettings> <dataPresenter:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type dataPresenter:CellValuePresenter}"> <Setter Property="Background" Value="{StaticResource MediumGrayBrush}" /> <Setter Property="Foreground" Value="{StaticResource WhiteBrush}" /> </Style> </dataPresenter:FieldSettings.CellValuePresenterStyle> </dataPresenter:FieldSettings> </dataPresenter:Field.Settings> </dataPresenter:Field> <dataPresenter:Field Name="E" Width="100" Column="1" Row="0" RowSpan="2"> <dataPresenter:Field.Settings> <dataPresenter:FieldSettings> <dataPresenter:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type dataPresenter:CellValuePresenter}"> <Setter Property="Background" Value="{StaticResource MediumGrayBrush}" /> <Setter Property="Foreground" Value="{StaticResource WhiteBrush}" /> </Style> </dataPresenter:FieldSettings.CellValuePresenterStyle> </dataPresenter:FieldSettings> </dataPresenter:Field.Settings> </dataPresenter:Field> </dataPresenter:FieldLayout> </dataPresenter:XamDataGrid.FieldLayouts>
The UnboundField is missing when copy\paste, if I use a Field, nothing is displayed.
I capture what I want and I have actually : http://gyazo.com/6f9a53ddf94f00ed686b09d002dd6896
Thanks for your help
Thanks for your solution, but when I paste the content, it's add one column (Excel 2007), I submit the idea on your link.
Regards
Thank you for your post. I have been looking into it and I can suggest you set the UnboundField's FieldSettings' CellMaxHeigth to 0 instead of its CellContentAlignment to LabelOnly. This way the header will appear, but all the headers will be on one line. If you want them to look the way they look in the XamDataGrid you can log a product idea for this here:
http://ideas.infragistics.com/