Today I had a requirement to check a property value without casting or converting it back to it's source class.
this is one way i foundout doing it..
Type t = element.DataContext.GetType();
foreach (var prop in t.GetProperties())
{
if (prop.Name == "MessageType")
{
string messageType = prop.GetValue(element.DataContext, null).ToString();
break;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment