private void SaveDefaultLayoutMenuItem_Click(object sender, EventArgs e) { Stream str = new MemoryStream(); pivotGrid.SaveLayoutToStream(str, opt); str.Position = 0; var sr = new StreamReader(str); var myStr = sr.ReadToEnd(); LayoutData = myStr; Bitmap b = new Bitmap(pivotGrid.Width, pivotGrid.Height); pivotGrid.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height)); SaveLayoutEventArgs args = new SaveLayoutEventArgs() { LayoutXML = myStr, ImageData = b }; SaveDefaultLayout(this, args); }