Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6094589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:41:50+00:00 2026-05-23T12:41:50+00:00

I’m losing data-bind when initiating a printing process, is that possible ? Thats what

  • 0

I’m losing data-bind when initiating a printing process, is that possible ? Thats what I can only think of in my situation here, where I have a Table inside a control that makes the Table data-bindable, all inside a FlowDocument. When running it the data-bind works fine and the table draws itself with some data on it with no problems.

However, when printing the output of that control is always blank.

I’ve added a ListView with the same bindings and when printing the generated data it too appears lost.

XAML:

<Window x:Class="GlassStore.InitBill"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:GlassStore.ViewModels"
        xmlns:flowdocs="clr-namespace:FlowDocuments;assembly=FlowDocument"
        Title="InitBill" Height="825" Width="1004">
<Window.DataContext>
    <local:InitBillViewModel/>
</Window.DataContext>
<Grid Background="White">
    <FlowDocumentReader HorizontalAlignment="Center"
                        HorizontalContentAlignment="Center">
        <FlowDocument ColumnWidth="999999"
                      IsColumnWidthFlexible="True"
                      TextAlignment="Center" 
                      Name="FD">
                <Paragraph>
                <ListView ItemsSource="{Binding GridTrans}">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="ffff"
                                 DisplayMemberBinding="{Binding CarModel}" />
                            <GridViewColumn Header="xxxx"
                                 DisplayMemberBinding="{Binding CarName}" />
                        </GridView>
                    </ListView.View>
                </ListView>
            </Paragraph>
            <Paragraph TextAlignment="Center">
                <TextBlock Text="{Binding test}" />
            </Paragraph>
            <flowdocs:ItemsContent ItemsSource="{Binding GridTrans}"
                                   Background="#FFF2C3C3"
                                   BorderThickness="2">
                <flowdocs:ItemsContent.ItemTemplate>
                    <DataTemplate>
                        <flowdocs:Fragment>
                            <Table>
                            <TableRowGroup flowdocs:Attached.IsItemsHost="True">
                                <TableRow Background="AliceBlue" >
                                    <TableCell Foreground="Red">
                                        <Paragraph>
                                            <flowdocs:BindableRun BoundText="{Binding CarName}" />
                                        </Paragraph>
                                    </TableCell>
                                    <TableCell Foreground="Green">
                                        <Paragraph>
                                            <flowdocs:BindableRun BoundText="{Binding CarModel}" />
                                        </Paragraph>
                                    </TableCell>
                                    <TableCell Foreground="Yellow">
                                        <Paragraph>
                                            <flowdocs:BindableRun BoundText="{Binding glassPrice}" />
                                        </Paragraph>
                                    </TableCell>
                                </TableRow>
                            </TableRowGroup>
                            </Table>
                        </flowdocs:Fragment>
                    </DataTemplate>
                </flowdocs:ItemsContent.ItemTemplate>
            </flowdocs:ItemsContent>
            <Table>
                <TableRowGroup>
                    <TableRow>
                        <TableCell>
                            <Paragraph>Row1 Cell1</Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph>Row2 Cell2</Paragraph>
                        </TableCell>
                    </TableRow>
                </TableRowGroup>
            </Table>  
        </FlowDocument>
    </FlowDocumentReader>
    <Button Command="{Binding print}"
            Content="إطـبع"
            Height="29" Margin="91,0,112,41"
            Name="button1"
            VerticalAlignment="Bottom" />
</Grid>
</Window>

Now I know the problem is not with the Custom Control, because I have the same problem now with ListView.

I’ve attached the source to the Window version here and the printed version here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:41:50+00:00Added an answer on May 23, 2026 at 12:41 pm

    The ViewModel would be nice, especially the method behind the print command. My guess ist, that the flowdocument is put into a special print context and loses the datacontext of the window.

    Try removing

    <Window.DataContext>
        <local:InitBillViewModel/>
    </Window.DataContext>
    

    and use

    <FlowDocumentReader HorizontalAlignment="Center" HorizontalContentAlignment="Center">
        <FlowDocumentReader.DataContext>
            <local:InitBillViewModel/>
        </FlowDocumentReader.DataContext>
    ...
    

    instead. Maybe that helps?

    Edit: The print command would have to move to another ViewModel to still work, of course. This other ViewModel would stay where the old one was, in the Window.DataContext.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.