我有一个DataGrid,
<DataGrid Name="grid">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding StudentName}" />
<DataGridTextColumn Header="Percentage"
Binding="{Binding PercentageDisplayValue}" />
</DataGrid.Columns>
</DataGrid>
这是对象类:
internal class DgObject
{
public DgObject(string _student, double _percent)
{
StudentName = _student;
Percentage = _percent;
}
public string StudentName { get; }
public double Percentage { get; }
public string PercentageDisplayValue => Percentage.ToString("F") + "%";
}
问题是,如何将属性绑定到不显示的列(在本例中为“Percentage”),但是仅用作排序变量? 谢谢。