我正在使用C#和XAML開發Windows應用商店應用程序。我在下面的代碼中將數據顯示在名爲greetingOutput
的文本塊中。XAML表格數據視圖
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有沒有解決方法?此外,我想添加功能到每一行,以便如果我點擊一行,它會轉到特定的鏈接。
我編輯了你的標題。請參閱:「[應該在其標題中包含」標籤「](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」。 – 2013-03-13 04:44:41
我想要像這樣的表格視圖http://msdn.microsoft.com/en-us/library/ms750416.aspx但我想知道如何使用XAML綁定數據。此外,我希望每一行都是可點擊的。 – Ramesh 2013-03-13 04:51:37