Skip to main content

DataControlSerializationOptions.RemoveOldColumns Attached Property

Gets or sets whether the columns that exist in a layout when it is restored but do not currently exist in the grid, should be discarded. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v22.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core



Type Description

true to discard the columns that exist in the layout being restored but do not currently exist in the grid; false to add these columns to the grid.


The RemoveOldColumns option affects how the grid’s layout is restored. If it is set to true, the columns that exist in the layout being loaded, but do not exist in the grid, will not be re-created. Otherwise, these columns will be added to the grid.

To learn more, see Saving and Restoring Layout.


This example shows how to save the GridControl‘s layout to a memory stream. To do this, click the Save Layout button. Click the Restore Layout button to restore the saved layout.

Serialize the WPF Grid

View Example: Save Layout and Restore It from a Memory Stream

<dxg:GridControl x:Name="grid"
    <dxg:GridColumn FieldName="IssueName"/>
    <dxg:GridColumn FieldName="IssueType"/>
    <dxg:GridColumn FieldName="IsPrivate" Header="Private"/>
        <dxg:TableView AutoWidth="True"/>

<StackPanel Grid.Row="1" Orientation="Vertical">
    <StackPanel Orientation="Horizontal">
        <Button Margin="1" Content="Add a New Column" Click="OnAddNewColumn"/>
    <StackPanel Orientation="Horizontal">
        <Button Content="Save Layout" Margin="1" Click="OnSaveLayout"/>
        <Button Content="Restore Layout" Margin="1" Click="OnRestoreLayout"/>
public partial class Window1 : Window {
    MemoryStream layoutStream;
    public Window1() {
        grid.ItemsSource = IssueList.GetData();

    void OnSaveLayout(object sender, RoutedEventArgs e) {
        layoutStream = new MemoryStream();
    void OnRestoreLayout(object sender, RoutedEventArgs e) {
        layoutStream.Position = 0;
    void OnAddNewColumn(object sender, RoutedEventArgs e) {
        grid.Columns.Add(new DevExpress.Xpf.Grid.GridColumn() { FieldName = "IsPrivate" });
See Also