Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Fixed Document Problem

$
0
0

I have a Problem With Fixed Documents  I Want My Client

To be able To Enter His Customers  ID So That He Can Retrieve

They Monthly Payment And So on but the Fixed Documents

Only can run One query,  as I enter The second  Customer ‘s

ID I get an Error                {"Specified Visual is already a child of another Visual or the root of a CompositionTarget."}               System.Exception {System.ArgumentException}

The  Code Create a Grid And  Fills It With All Required Data and Then Runs The Following

Statement 

   FixedPage clientFixedPage = new FixedPage();               Grid clientGrid = new Grid();        RowDefinition clientRow;        ColumnDefinition clientColumn;              PageContent clientPage = new PageContent();

   //Output Reports Results  In Fixed Document

                       // if (clientPage .Child==null )

                       // {

                clientGrid.Width = this.clientAccountFixedDocument.DocumentPaginator.PageSize.Width;

clientGrid.Height = this.clientAccountFixedDocument.DocumentPaginator.PageSize.Height

clientFixedPage.Children.Add(clientGrid);

((System.Windows.Markup.IAddChild)clientPage).AddChild(clientFixedPage);

 this.clientAccountFixedDocument.Pages.Add(clientPage);

                       // }

                        //else if (clientPage .Child !=null )

                       // {

                           // clientFixedPage.Children.Clear();

                         //   clientFixedPage = new FixedPage();

                            //clientPage.Child.Children.Clear();

                           //clientFixedPage.Children.Add(clientGrid);

                           // ((System.Windows.Markup.IAddChild)clientPage).AddChild(clientFixedPage);

                           // this.clientAccountFixedDocument.Pages.Add(clientPage);

                      //  }

                        

The XAML Locks Like This

<DocumentViewer  VerticalAlignment="Top"  Grid.Column="0"
         Grid.Row="2"    x:Name="clientAccountDocumentViewer" HorizontalAlignment="Stretch" Width="auto"    DataContext="{Binding}" >
            <FixedDocument x:Name="clientAccountFixedDocument" />                         
        </DocumentViewer>
The Control That Run Customers ID Lock Like This

 private void accIdTxt_KeyDown(object sender, KeyEventArgs e)
        {
            rentalClientAccount = new RentalClientAccount();
            int rowCounter = 0;
            if (e.Key == Key.Enter){
 if (accIdTxt.Text.Length > 0 & yearTxt.Text.Length > 0){
               foreach (EstateSerializer clientAccountItems in
 rentalClientAccount.GetClientPaymentByAccountID(this.accIdTxt.Text, int.Parse(yearTxt.Text)))
                        {
    



Viewing all articles
Browse latest Browse all 18858

Trending Articles