我正在使用 C# 和 XAML 开发 Windows Store 应用程序。我greetingOutput
在以下代码中调用的文本块中显示数据。
try
{
var response = navigationParameter.ToString();
var serializer = new DataContractJsonSerializer(typeof(QualityRecordsRootObject));
var stream = new MemoryStream(Encoding.UTF8.GetBytes(response));
QualityRecordsRootObject qualityRecordsRootObject = (QualityRecordsRootObject)serializer.ReadObject(stream);
greetingOutput.Text = String.Format("{0,60}{1,60}{2,60}{3,60}",
"Brand",
"Printer",
"Printer Location",
"Date Received");
greetingOutput.Text += "\n\n";
for (int i = 0; i < qualityRecordsRootObject.auditDTOList.Count(); i++)
{
greetingOutput.Text += String.Format("{0,60}{1,60}{2,60}{3,60}",
qualityRecordsRootObject.auditDTOList[i].brandName,
qualityRecordsRootObject.auditDTOList[i].printerName,
qualityRecordsRootObject.auditDTOList[i].printerLocationName,
qualityRecordsRootObject.auditDTOList[i].receivedDate);
greetingOutput.Text += "\n";
}
}
catch (Exception ex)
{
Debug.WriteLine("exception: " + ex.Message);
greetingOutput.Text += " No Records Found!";
}
但它看起来并不好;我想要看起来不错的表格数据视图。XAML 中是否有任何解决方法?另外我想为每一行添加功能,这样如果我点击一行,它就会转到一个特定的链接。