Set Diagram/Pallete properties from behind code

Hi ,
How can I set below sentence in behind code?

                <go:GridLayout CellSize="30 30" Spacing="5 5" Sorting="Forward" />


    var lay = new GridLayout();
    lay.CellSize = new Size(30, 30);
    lay.Spacing = new Size(5, 5);
    lay.Sorting = GridSorting.Forward;
    myDiagram.Layout = lay;

Thanks for quick reply , Walter

Is there any difference between definition you wrote and following: (declared before InitializeComponent() ). I mean in temrs of performance or architecture.

    GridLayout lay = new GridLayout()
    { CellSize = new Size(width: 30, height: 30), Spacing = new Size(width: 5, height: 5), Sorting = GridSorting.Forward };

I’m not sure, but I think they all have the same result.

ok , Thanks a lot! Ticket status is resolved.