Skip to content

WPF Textblock text clipped when writing to XPS if textblock has dropshadoweffect and inside a Viewbox #3745

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


I am re-posting this as it has been closed but not solved.

Here is the XAML for an example window:

<Window x:Class="DropShadowProblem.MainWindow"
        xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:DropShadowProblem"
         mc:Ignorable="d"
         Title="MainWindow" Height="340" Width="600" MouseDoubleClick="MainWindow_OnMouseDoubleClick">
     <DockPanel>
         <Canvas Name="Canv">
             <Border>
                 <Viewbox StretchDirection="DownOnly" Width="580" Height="300" >
                     <TextBlock FontSize="400" Foreground="BlueViolet" Text="Hello" >
                         <TextBlock.Effect>
                             <DropShadowEffect ShadowDepth="30"></DropShadowEffect>                         </TextBlock.Effect>
                     </TextBlock>
                 </Viewbox>
             </Border>
         </Canvas>
     </DockPanel>
 </Window> 

And here is the code behind:

using System.IO; using System.Printing;
using System.Windows; 
using System.Windows.Input; 
using System.Windows.Xps.Packaging; 
using Microsoft.Win32; 

namespace DropShadowProblem
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void MainWindow_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var sfd = new SaveFileDialog { Filter = "XPS files (.xps)|.xps" };
if (sfd. ShowDialog() != true) return;
var c = Canv;
var doc = new XpsDocument(sfd. FileName, FileAccess.Write);
var writer = XpsDocument.CreateXpsDocumentWriter(doc);
writer. Write(c, new PrintTicket { PageMediaSize = new PageMediaSize(c.ActualWidth, c.ActualHeight) });
doc. Close();
}
}
}

And here is the resulting XPS:

Image:87446-30306-capture.png


Original Comments

Feedback Bot on 8/12/2019, 02:35 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 10/8/2019, 05:23 PM:

I have detected that for the last 35 days, this issue didn't have any product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions