Hi; Basically; I need to invoke a method on my WPF page, from a WPF frame where I load the WPF Page. I get the loaded page using Frame.Content property, and cast it to my page type since Content property returns Object type. The project builds successfully, however it throws InvalidCastException at runtime.
//This line throws InvalidCastException at runtime...
((PageA)TargetFrame.Content).methodA();
Here is the exception details:
[A]LoongNamespaceA.PageA cannot be cast to [B]LoongNamespaceA.PageA.
Type A originates from 'AssemblyA, Version=1.0.0.58, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\abdullah.battal\AppData\Local\AssemblyA.dll'.
Type B originates from 'AssemblyA, Version=1.0.0.58, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\loongPathToSourceProject\bin\AssemblyA.dll'.
notice the context and location difference...
how can we solve this one?