如何在屏幕上显示输出?

时间:2013-04-03 05:23:11

标签: c#

我编写了所有内容,当我运行项目时,它没有在屏幕上显示输出。任何人都可以告诉我,用于在屏幕上显示输出的代码是什么?

这是我(非控制台)应用程序中使用的代码。

private async void Button_Click_1(object sender, RoutedEventArgs e) {
    StorageFile xmlFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Content1.xml");
    XmlDocument xmlDoc;
    xmlDoc = await XmlDocument.LoadFromFileAsync(xmlFile);
    System.Xml.Linq.XDocument duc = System.Xml.Linq.XDocument.Parse(xmlDoc.GetXml());

    var query=
        from Date in duc.Root.Elements("Serial")
        where Date.Attribute("No").Value=="1"
        from Current in Date.Elements("Current")
        select new {
            NarratedBy=Current.Attribute("NarratedBy").Value,
            value=Current.Attribute("Date").Value
        };

    foreach(var Date in query) {
        System.Diagnostics.Debug.WriteLine("{0}\t{1}", Date.NarratedBy, Date.value);
    }
}

1 个答案:

答案 0 :(得分:1)

您可以使用多行TextBoxRichTextBoxTextBlock并将文字附加到其显示位置并使用String.Format格式化文字。

TextBox1 +=  String.Format("{0}\t{1}", Date.NarratedBy, Date.value) + Environment.NewLine;
相关问题