-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
- .NET Core Version: 3.0
- Windows version: Win 10 1903 (18362.239)
- Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
- Is this bug related specifically to tooling in Visual Studio: No
Problem description:
I have a textblock with the built-in drop shadow effect. If the textblock is within a viewbox and the width and height of the window is around the size of the viewbox then the text is clipped when you save to XPS
Actual behavior:
Clipped XPS document
Expected behavior:
XPS document which represents the WPF visual
Minimal repro:
Xaml Window
<Window x:Class="XpsDropShadowCore.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:XpsDropShadowCore" mc:Ignorable="d" Title="MainWindow" Height="340" Width="600" MouseDoubleClick="MainWindow_OnMouseDoubleClick"> <Canvas Name="Canv"> <Viewbox StretchDirection="DownOnly" Width="580" Height="300" > <TextBlock FontSize="400" Foreground="BlueViolet" Text="Hello" > <TextBlock.Effect> <DropShadowEffect ShadowDepth="30"></DropShadowEffect> </TextBlock.Effect> </TextBlock> </Viewbox> </Canvas> </Window>
Window Code behind
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.ReadWrite); var writer = XpsDocument.CreateXpsDocumentWriter(doc); writer.Write(c); doc.Close(); } }