Print WPF grid without GridLines

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
dpatel_teamAsked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.