The textbox control cannot display the content of the pdf anyway, and it cannot parse the format of the pdf file.
To display pdf in WPF, the easiest way should be to add a nuget package: Microsoft.Web.WebView2
Then use the following code to do it:
<Grid>
<Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="697,159,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
<Wpf:WebView2 x:Name="webview2" Height="299" Margin="41,47,0,0" VerticalAlignment="Top" Width="480"/>
</Grid>
public MainWindow()
{
InitializeComponent();
webview2.Source = new Uri(@"http://www.bing.com");
}
private void button_Click(object sender, RoutedEventArgs e)
{
webview2.CoreWebView2.Navigate(@"C:\...\sample.pdf");
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.