0

I am new to programming. I am currently using WPF in C# to generate data from XML file into a data grid (table). I am using the MVVM format. For my Model class I name it as PersonInfos, and it includes "First Name", "Last Name", "Select" and "Age" columns. I would like to create a txt file based on the rows selected by user by clicking the checkbox in the "Select"-column. The format of txt file is showed below:

e.g.
P§Alexander§Jason§24§

P§ = It is the keyword for PersonInfos
Alexander§ = Last Name
Jason§ = First Name
24§ = Age

I will show my code of WPF in xaml below to give a better idea.

<syncfusion:GridTreeControl.Columns>
                <syncfusion:GridTreeColumn MappingName="LastName" PercentWidth="3" /> 
                <syncfusion:GridTreeColumn MappingName="FirstName" PercentWidth="3" /> 
                <syncfusion:GridTreeColumn MappingName="Age" PercentWidth="2" /> 
                <syncfusion:GridTreeColumn MappingName="Select" PercentWidth="2">
                    <syncfusion:GridTreeColumn.StyleInfo>
                        <syncfusion:GridDataStyleInfo
                                CellType="DataBoundTemplate"
                                CellItemTemplate="{StaticResource SelectCheckBoxTemplate}"/>
                    </syncfusion:GridTreeColumn.StyleInfo>
                </syncfusion:GridTreeColumn>            
</syncfusion:GridTreeControl.Columns>

Thank you for your time!

1 Answer 1

1

The simplest way to do it is to add a property bool IncludeInExport to your model class (or a class that derivates the model class or is partial to model class) and map it to checkbox of the grid. In export you'll add just checked rows (PersonInfos collection items with IncludeInExport == true).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.