I have chunks of XAML displayed on my screen that I make **printable** with a print button inside that chunk, something like this:

```
<Border DockPanel.Dock="Top" x:Name="PrintableArea">
    <StackPanel 
            HorizontalAlignment="Right"
            VerticalAlignment="Bottom">
        <ContentControl Background="Green" x:Name="ManageButtonsContainer"/>
        <Button x:Name="PrintButton" Content="Print" Click="Button_Click_Print"/>
    </StackPanel>
</Border>  

```

But when this chunk prints out, I don't want the **print button** to be printed, so I **hide** it before I print and make it visible again after I print, like this:

```
private void Button_Click_Print(object sender, RoutedEventArgs e)
{
    PrintButton.Visibility = Visibility.Collapsed;
    PrintDialog dialog = new PrintDialog();
    if (dialog.ShowDialog() == true)
    { dialog.PrintVisual(PrintableArea, "Print job"); }

    PrintButton.Visibility = Visibility.Visible;
}

```

This works, but when the print dialog appears, you see **behind** the print dialog that the print button disappears and then reappears again, which is just a little unconventional UI behavior that I would like to avoid.

**Is there a way to keep elements visible on the screen yet hide them from printing?**

e.g. something like this (pseudo-code):

```
<Button x:Name="PrintButton" Content="Print" 
   HideWhenPrinting=True"
   Click="Button_Click_Print"/>

```

Pragmatic answer:
=================

Ok, I solved this particular issue simply by changing the visibility only if they actually print, but it would still be nice to know in principle if there is a way to set "printable visibility" in XAML so this issue doesn't always have to be taken care of in code like this:

```
private void Button_Click_Print(object sender, RoutedEventArgs e)
{
    PrintDialog dialog = new PrintDialog();
    if (dialog.ShowDialog() == true)
    {
        PrintButton.Visibility = Visibility.Collapsed;
        dialog.PrintVisual(PrintableArea, "Print job");
        PrintButton.Visibility = Visibility.Visible;
    }
}

```