I have an RIA Services Silverlight 3.0 app using an EF model. In the model metadata I've included several Display Name properties that I'd like to use when referring to the model on the client-side (in TextBoxes, etc.. .)
I'm using reflection now to get the properties of the model on the client so that if the model changes over time, I don't need to update the client code. I just can't figure out how to access the metadata.
private void Field_Loaded(object sender, RoutedEventArgs e)
{
System.Reflection.MemberInfo[] members = this.ModelType.GetMembers();
foreach (System.Reflection.MemberInfo member in members)
{
System.Reflection.PropertyInfo property = member as System.Reflection.PropertyInfo;
if (property != null && property.PropertyType == typeof(System.String))
{
ComboBoxItem item = new ComboBoxItem();
item.Content = property.Name; // <--- This is where I want to use Display Name
this._field.Items.Add(item);
}
}
}
Thanks in advance,