简体   繁体   中英

Export Datagrid to csv when using datatemplate

My xaml looks like this:

<sdk:DataGrid x:Name="dg_Ingaven" ItemsSource="{Binding}">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTemplateColumn Header="ID">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ID}" />
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>   
                    </sdk:DataGridTemplateColumn>
                    ...

I need to convert the datagrid to an csv file I found alot of solutions if Datagrid is AutoGenerateColumns = "true" but how do I make it work with datagridcolumns with a textblock inside?

this is the solution I found: Silverlight DataGrid: Export to excel or csv

通过使用DataGridTextColumn解决了它!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM