[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Print WPF grid without GridLines

Posted on 2011-10-27
1
Medium Priority
?
568 Views
Last Modified: 2012-06-27
I have grid array and I want to print all the grid.each grid have in his cell textbox the grid set to
ShowGridLines = false;

Open in new window

and also I have a method the remove the textbox border.
private void DeletBorder()
{
Thickness bor = new Thickness(0.0);
for (int i = 0; i < this.gridArray.Length; i++)
{
    foreach (Control ctrl in this.gridArray[i].Children)
    {
        if (ctrl.GetType() == typeof(TextBox))
        {
            ((TextBox) ctrl).BorderThickness = bor;
        }
    }
}
 }

Open in new window

i am trying to print all the grids in the array with this method:
 private void button1_Click(object sender, RoutedEventArgs e)
{
if (this.comboBox1.SelectedIndex > -1)
{
    PrintDialog printDlg = new PrintDialog();
    this.DeletBorder();
    if (printDlg.ShowDialog() == true)
    {
        this.DeletBorder();
        foreach (Grid item in this.gridArray)
        {
            printDlg.PrintVisual(item, "Stiker Print Job");
        }
    }
}
else
{
    MessageBox.Show("you must select the page layout first");
}
}

Open in new window

but the result is that only the first page printed without border/gridLines but the other still printed with border/gridLines
0
Comment
Question by:dpatel_team
1 Comment
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 37040460
Have you tried setting ShowGridLines=False on your front end grid directly?

If you need to conditionally show/hide the grid lines, bind to a value and use a converter.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question