I am trying to use WPFToolkit in my user control dll. I inserted the WPFToolkit in its reference, and my user control dll builds with no error. Then I insert my user control dll into my application, but when my application new an object of my user control dll
MultiROIStats mroi = new MultiROIStats();
the exception occured, saying:
Additional information: Could not load file or assembly 'WPFToolkit, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Here is my user control dll code, the constructor where the error occurs.
View xaml code:
<Window x:Class="MultiROIStats.MultiROIStats"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<dg:DataGrid ItemsSource="{Binding Path=FileData}" Margin="0,30,0,0" />
<Button Height="22" HorizontalAlignment="Left" Margin="8,4,0,0"
Name="button1" VerticalAlignment="Top" Width="48"
Command="{Binding Path=GetDataCommand}">Button
</Button>
</Grid>
</Window>
View C# code
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;
namespace MultiROIStats
{
using System.Windows;
using ViewModel;
//xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit"
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class MultiROIStats : Window
{
public MultiROIStats()
{
InitializeComponent(); // exception occurs here!
DataContext = new MultiROIStatsViewModel();
}
}
}
I also checked the binary folder of my user control dll, the WPFToolkei.dll is there. So I am confused, and I am wondering how can I correct this error? Thanks.