I have followed your example, as good as I could. I cannot see why you controls are freezing.
It seems that the issue is located anywhere else.
I added the Acrobat Reader Control to a UserControl "UserControl1"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WpfApplication9
{
public partial class UserControl1 : UserControl
{
public UserControl1(string filepath)
{
InitializeComponent();
this.axAcroPDF1.LoadFile(filepath);
this.axAcroPDF1.setZoom(63);
}
}
}
I created a WPF Window, like this:
Window x:Class="WpfApplication9.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:WpfApplication9"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<WindowsFormsHost x:Name="host"/>
<ToggleButton Content="Toggle" Grid.Column="1" Click="ToggleButton_Click" />
</Grid>
</Window>
and with this code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Microsoft.VisualBasic;
namespace WpfApplication9
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
UserControl1 uc = new UserControl1(System.IO.Path.Combine(Microsoft.VisualBasic.FileIO.SpecialDirectories.Desktop, "Test.pdf"));
this.host.Child = uc;
}
private void ToggleButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hallo welt!");
}
}
}
After the pdf file was loaded I could fire the Toggle Button Event, so Messagebox was shown. This is the reason why I gues your issue Comes from anywhere else.