In this situation, you need to type cast. You can not get the type of an object without a cast because for e.OriginalSource
type will be Object
. Besides, in the construction typeof
is to be an object of System.Type
type:
Used to obtain the
System.Type
object for a type.
Therefore try this:
Page page = e.OriginalSource as Page;
if (page != null)
{
string test = page.ToString();
}
Or just use ToString()
method for e.OriginalSource
like you mentioned.