Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有标签和文本框的网格。 我想获取标签的内容。 如果你知道它是一个标签,那就很容易了。 但这就是我所拥有的:
foreach (var t in Grid1.Children) { if (t.GetType() == typeof(Label)) { string val = t.????; } }
如何获取此标签的内容?
foreach (var t in Grid1.Children) { if (t is Label) { string val = ((Label)t).Content.ToString() } }