以下查询所需的编码解决方案 [英] Coding solution needed for the following query

查看:81
本文介绍了以下查询所需的编码解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在wpf应用程序中手动创建标签数组(即没有从ToolBox中拖放标签)?

How to create array of labels manually(i.e without drag and drop of labels from ToolBox) in wpf application?

推荐答案





只需动态创建控件(标签)。这是一个小代码片段,演示了这个概念:



Hi,

Just create the controls (labels) dynamically. Here is a small code snippet that demonstrates the concept:

var window = new Window();
var stackPanel = new StackPanel { Orientation = Orientation.Vertical };
stackPanel.Children.Add(new Label { Content = "Label" });
stackPanel.Children.Add(new Button { Content = "Button" });
window.Content = stackPanel;





否则,请参阅以下内容: wpf - 动态创建控件 [ ^ ]



亲切的问候,



Otherwise, refer to the following: wpf - create controls dynamically[^]

Kind regards,


这篇关于以下查询所需的编码解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆