Double-click on the Layout” button to create an event handler for its Click Event. “Save I will add the following code to save the grid’s layout. Note that I am creating a new XML file in the application directory, called “layout.xml”. Then I write the current layout to the stream by using the SaveLayoutToStream method of the GridView. Finally, when the view settings have been written to the XML file, I close the stream. Switch back to Design view. I am now going to add a line of code to the Layout” button’s Click Event. “Restore Double-click the button and add the following code to its event handler. I will use the method to load the view settings from the XML file. “RestoreLayoutFromXml” And I’m done! I run the application to see the results. I invoke the filter editor by clicking the Filter” button. “Edit Let’s create a filter to display cars that have engines with 6 or more cylinders. I apply the filter condition and close the editor. Next, I’m going to change the view even more by grouping the data by specific columns. Now that I have customized the view, I am going to save it by clicking the Layout” button. “Save First, let’s see what the content of this XML file looks like. I locate the file in my application folder and open it. “layout.xml” You can see the GridView properties listed as nodes. “property” Additionally, our custom filter is also saved in the property. “ActiveFilterString” Let’s return to our application. I’m going to clear the filter criteria and the column groupings.
Double-click on the “Save Layout” button to create an event handler for its Click Event. I will add the following code to save the grid’s layout. Note that I am creating a new XML file in the application directory, called “layout.xml”. Then I write the current layout to the stream by using the SaveLayoutToStream method of the GridView. Finally, when the view settings have been written to the XML file, I close the stream. Switch back to Design view. I am now going to add a line of code to the “Restore Layout” button’s Click Event. Double-click the button and add the following code to its event handler. I will use the “RestoreLayoutFromXml” method to load the view settings from the XML file. And I’m done! I run the application to see the results. I invoke the filter editor by clicking the “Edit Filter” button. Let’s create a filter to display cars that have engines with 6 or more cylinders. I apply the filter condition and close the editor. Next, I’m going to change the view even more by grouping the data by specific columns. Now that I have customized the view, I am going to save it by clicking the “Save Layout” button. First, let’s see what the content of this XML file looks like. I locate the “layout.xml” file in my application folder and open it. You can see the GridView properties listed as “property” nodes. Additionally, our custom filter is also saved in the “ActiveFilterString” property. Let’s return to our application. I’m going to clear the filter criteria and the column groupings.