Answer the question
In order to leave comments, you need to log in
How to search for elements in xml without a name?
There is a WPF with a grid already placed, it has the name "etalons_grid_perent"
<Grid x:Name="etalons_grid_perent" Background="#FF96B7F9" Height="346" >
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="80"/>
<RowDefinition Height="*" MinHeight="80"/>
<RowDefinition Height="*" MinHeight="80"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" MinWidth="100"/>
<ColumnDefinition Width="50*" MinWidth="100"/>
<ColumnDefinition Width="50*" MinWidth="100"/>
<ColumnDefinition Width="50*" MinWidth="100"/>
</Grid.ColumnDefinitions>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height = "0.8*" />
< RowDefinition Height= "1*" />
</Grid.RowDefinitions >
< Label Content= "EtalonName_1" VerticalAlignment= "Bottom" HorizontalAlignment= "Center" />
< TextBox HorizontalAlignment= "Center" Grid.Row= "1" Text= "----" VerticalAlignment= "Top" Width= "80" Margin="0,10,0,0" TextAlignment= "Center" />
</ Grid >
Label[] label = etalons_grid_perent.AllChildren(Label, search_in_children = True).Filter(Content = "EtalonName_1");
Answer the question
In order to leave comments, you need to log in
The first question: and if you add them dynamically, why don't you store references to them in an array, for example?
If for some reason you do not want to do this, the second question is - the Content tag is intended to indicate ... the content (content) of the element, but not the label (name). There is a "Name" attribute for this.
Well, like this:
.Where(l => l.Content.Contains("EtalonName"));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question