简体   繁体   English

不使用XAML将UI添加到当前页面-Windows Phone Silverlight 8.1

[英]adding UI to current page without using XAML - Windows Phone Silverlight 8.1

I need to add to the current page some UI but I cannot use XAML. 我需要向当前页面添加一些UI,但不能使用XAML。

For instance, I am creating a textBlock this way: 例如,我以这种方式创建一个textBlock:

TextBlock textBlock = new TextBlock();
textBlock.Text = "text1";
Grid myGrid = new Grid();
myGrid.Children.Add(textBlock);

What I need to do in order to display myGrid attached to my current page? 为了显示附加到当前页面的myGrid我需要做什么?

What you are referring to is building a UI programmatically. 您所指的是以编程方式构建UI。 Here is a link to an article that explains it 这里是解释它的文章的链接

http://www.kirupa.com/blend_silverlight/programmatically_adding_elements_pg1.htm http://www.kirupa.com/blend_silverlight/programmatically_adding_elements_pg1.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM