Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,
I am developing a form using WPF. In that I've used several labels in XAML. Now I want to get count of these labels at xaml.cs file i.e at back-end.
So how can I get it. And I also want to retrieve name of label in for-loop. Please help me
Posted
Comments
Maciej Los 1-Dec-14 8:59am    
Why? What language?

1 solution

MSDN wrote:
Windows Presentation Foundation (WPF) ships with many of the common UI components that are used in almost every Windows application, such as Button, Label, TextBox, Menu, and ListBox. Historically, these objects have been referred to as controls. While the WPF SDK continues to use the term "control" to loosely mean any class that represents a visible object in an application, it is important to note that a class does not need to inherit from the Control class to have a visible presence. Classes that inherit from the Control class contain a ControlTemplate, which allows the consumer of a control to radically change the control's appearance without having to create a new subclass. This topic discusses how controls (both those that do inherit from the Control class and those that do not) are commonly used in WPF.

source: http://msdn.microsoft.com/en-us/library/bb613551%28v=vs.110%29.aspx[^]

WPF uses VisualTreeHelper[^] which exposes methods to perform common tasks involving nodes in a visual tree.

Please refer this:
Understanding the Visual Tree and Logical Tree in WPF[^]
How can I find WPF controls by name or type?[^]
Find all controls in WPF Window by type[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900