动态更改文本块内容

动态更改文本块内容

本文介绍了C# - wp8:动态更改文本块内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中有几个 html 文件.我通过 webBrowser 显示它.我将当前显示页面的编号存储为 string Page.我想在文本块中显示该页面名称.所以,我将这些文本存储为字符串.例如

I have several html files in my app. I displayed it through webBrowser. I stored that current displaying page's number as string Page. I wanna display that page name in textblock. So, I have stored those text as string's. For example

string chapter1 = "Welcome page";
string chapter2 = "About us";
//...// 100 strings

如果在浏览器中显示欢迎页面,string page 将为 1.通过使用 string page string Chapter1 应为 fileName.Text 同样我想显示.但是,我不知道该怎么做.最好的答案将不胜感激.

If welcome page is displayed in webbrowser, the string page will be 1. by using string page string chapter1 should be fileName.Text likewise i wanna display. but, I dunno how to do so. Best answers will be much appreciated.

C# 代码;

TextBlock fileName = new TextBlock();
fileName.Margin = new Thickness(0);
fileName.FontSize = 30;
fileName.Foreground = new SolidColorBrush(Colors.White);
fileName.TextAlignment = TextAlignment.Center;
fileName.Text = "???";

推荐答案

我使用 switch 语句完成了.总之谢谢大家

I done it using switch statement. Anyway thanks for all

这篇关于C# - wp8:动态更改文本块内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:16