这似乎应该是直截了当的,但我似乎无法获得模型Entities
类型和名称?
我可以在编辑class
时获取class
名称/类型,但不能获取我正在访问的DataGrid
内的属性。
这是我试图获取值的事件:
protected void OnDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.EditAction == DataGridEditAction.Commit)
{
var userControl = FindVisualParent<UserView>(sender as UIElement);
var rowType = e.Row.Item.GetType(); //This gets the class type
//trying to get name and type of entity here
var name = e.Row.Item. ??????
var type = e.Row.Item.GetType(). ??????
}
}
这是Model
,我首先使用代码EntityFrameWork
public partial class Bank
{
public System.Guid Id { get; set; } // ID (Primary key)
public string Section { get; set; } // Section (length: 50)
public string Name { get; set; } // Name (length: 50)
public Bank()
{
InitializePartial();
}
partial void InitializePartial();
}
为了让事情变得更加清晰,我想在上面的类中获取Property
Property
名为Section
的名称和类型。如何从OnDataGrid_CellEditEnding
事件中执行此操作?