diff --git a/.github/workflows/dependencies/Get-MSBuildResults.ps1 b/.github/workflows/dependencies/Get-MSBuildResults.ps1 index 6a96c7f6f2..85711e060a 100644 --- a/.github/workflows/dependencies/Get-MSBuildResults.ps1 +++ b/.github/workflows/dependencies/Get-MSBuildResults.ps1 @@ -135,7 +135,7 @@ foreach ($item in $workingSet) { $configFile = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($projectFile), "snippets.5000.json") # Create the default build command - "dotnet build `"$projectFile`"" | Out-File ".\run.bat" + "dotnet build `"$projectFile`" /p:UseWPF=True" | Out-File ".\run.bat" # Check for config file if ([System.IO.File]::Exists($configFile) -eq $true) { diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs index 70a6158b2c..42c6c75ede 100644 --- a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs +++ b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs @@ -41,8 +41,8 @@ private Drawing DrawMyText(string textString) FlowDirection.LeftToRight, new Typeface("Comic Sans MS Bold"), 48, - System.Windows.Media.Brushes.Black // This brush does not matter since we use the geometry of the text. - ); + System.Windows.Media.Brushes.Black, // This brush does not matter since we use the geometry of the text. + VisualTreeHelper.GetDpi(this).PixelsPerDip); // Build the geometry object that represents the text. Geometry textGeometry = formattedText.BuildGeometry(new System.Windows.Point(20, 0)); @@ -66,4 +66,4 @@ private void OnButtonClick(object sender, EventArgs e) myCanvas.Background = new DrawingBrush(DrawMyText(myTextBox.Text)); } } -} \ No newline at end of file +}