Answered by:
Unknown build error while using WPF toolkit Datepicker control

Question
-
Hi
We have two projects such as
1)PrjCustomControls
2)PrjMain
We are using custom Datepicker control in "PrjCustomControls" project which has been inherited from WPF Datepicker control that comes along with WPF Toolkit
We added WPFToolkit reference in PrjCustomControls project and it build successfully
In our PrjMain project we have added this custom control in one of the Xaml pages after adding corresponding namespace. But, while building PrjMain project we are getting following error..(truncated error message)
Unknown build error, 'Cannot resolve dependency to assembly 'WPF Toolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
When we added WPFToolkit reference into PrjMain, then PrjMain project builds successfully
My Question here: Why should we add WPFToolkit reference in PrjMain since we already added WPFToolkit reference in PrjCustomControls project and this project reference added in PrjMain ? .
Can someone plesae shed some light on this? am I doing any wrong?
I will definitely appreciate your help.
Tuesday, June 1, 2010 1:02 PM
Answers
-
Hi Faisal Noordeen,
I will explain it in a more easy way.
If we have a class ClassA in LibraryA, a ClassB in LibraryB which is inherited from ClassA, so we need to add the reference of LibraryA in the LibraryB. And if we use the ClassB in LibraryC, we need add the reference of both LibraryA and LibraryB. Because when we create a ClassB object, it will invoke the constructor of ClassB and the base class constructor of ClassA, so we need to add the reference of LibraryA, otherwise the complier cannot find the constructor of ClassA.Hope this helps.
Best regards,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked as answer by Faisal Noordeen Tuesday, June 8, 2010 4:34 AM
Tuesday, June 8, 2010 3:40 AM
All replies
-
Hi Faisal Noordeen,
If your custom control inherited from a WPF Toolkit class and use that control in your PrjMain project, in this case the compiler needs to have reference to the WPF Toolkit assembly, because the it basically uses a class from the WPF ToolKit.
Hope this helps.
Best regards,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Thursday, June 3, 2010 1:10 PM -
Hi Linda Liu,
Thanks for your response..
I am not very clear ,can you please correct if am wrong ...
We actually added WPToolkit reference in PrjCustomControls project where our custom DatePicker component belongs to.
Public Class CustDatePicker: DatePicker // DatePicker is WPF Toolkit class
We have separate Main Project PrjMain. We have added this CustDatePicker in one of the Xaml pages(Provided added reference of PrjCustomControls reference in PrjMain Project).
We added CustDatePicker in myPage.xaml like following
<cust:CustDatePicker x:Name="DOB"....../>
If we not add WPFToolkit reference in PrjMain too, we are getting build error mentioned in the previous post
Why Should we add WPFToolkit reference to PrjMain Project too?(Since we are basically using base WPFToolkit class in PrjCustomControls project only and already added WPFToolkit reference in PrjCustomControls project)
Please let me know if my understanding is wrong. I appreciate your help
Thanks & Regards,
Faisal. N
Saturday, June 5, 2010 6:55 AM -
Hi Faisal Noordeen,
I will explain it in a more easy way.
If we have a class ClassA in LibraryA, a ClassB in LibraryB which is inherited from ClassA, so we need to add the reference of LibraryA in the LibraryB. And if we use the ClassB in LibraryC, we need add the reference of both LibraryA and LibraryB. Because when we create a ClassB object, it will invoke the constructor of ClassB and the base class constructor of ClassA, so we need to add the reference of LibraryA, otherwise the complier cannot find the constructor of ClassA.Hope this helps.
Best regards,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked as answer by Faisal Noordeen Tuesday, June 8, 2010 4:34 AM
Tuesday, June 8, 2010 3:40 AM -
Hi Linda Liu,
Thanks very much for the this info.
I was not aware the fact that both library should be added in the Main project library eventhough we are using one library through another library (not directly).
I appreciate this help.
Regards,
Faisal. N
Tuesday, June 8, 2010 4:43 AM