4

I have a FixedPage class as follows

        PageContent pageContent = new PageContent();
        FixedPage fixedPage = new FixedPage();
        double pageWidth = 96 * 8.5;
        double pageHeight = 96 * 11;
        fixedPage.Width = pageWidth;
        fixedPage.Height = pageHeight;
        Size sz = new Size(8.5 * 96, 11 * 96);
        fixedPage.Measure(sz);
        fixedPage.Arrange(new Rect(new Point(), sz));
        fixedPage.UpdateLayout();

        ((IAddChild)pageContent).AddChild(fixedPage);

and an IEnumerable object as follows

IEnumerable<FixedPage> page;
page.Concat(new[] { fixedPage });

in the line

page.Concat(new[] { fixedPage });

Its showing error as

'Use of unassigned local variable 'page''

How can I assign fixedPage to page?

I also need help to create a fixedPage object(elements)

Sudha
  • 2,078
  • 6
  • 28
  • 53
  • 1
    When I try to run this code an InvalidOperationException (The calling thread must be STA, because many UI components require this) in PageContent pageContent = new PageContent(); – Sudha Apr 02 '13 at 11:23
  • 1
    I tried again by commenting the line PageContent pageContent = new PageContent(); Then same error in FixedPage fixedPage = new FixedPage(); – Sudha Apr 02 '13 at 11:24

1 Answers1

0

You should initialize the page variable by creating a new instance of a class, which implements the IEnumerable interface, for example the generic List class:

IEnumerable<FixedPage> page = new List<FixedPage>(new FixedPage[] { fixedPage });
Pavel Vladov
  • 4,707
  • 3
  • 35
  • 39
  • 1
    This is the answer for How can I assign fixedPage to page? I also need to get some insight on my deal with fixedPage class – Sudha Apr 02 '13 at 12:28