So I have a couple of Elements I want to use in my c# class. These are a few lines of my xaml document that I want to extract the elements from:
<TextBlock x:Name="diastolic17" FontSize="10" Foreground="Ivory" Grid.Row="19"
Grid.Column="4"
TextAlignment="Center">0</TextBlock>
<TextBlock x:Name="diastolic18" FontSize="10" Foreground="Ivory" Grid.Row="20"
Grid.Column="4"
TextAlignment="Center">98</TextBlock>
<TextBlock x:Name="diastolic19" FontSize="10" Foreground="Ivory" Grid.Row="21"
Grid.Column="4"
TextAlignment="Center">88</TextBlock>
They are all in the same namespace. I used to just use the x:Name property to get the TextBlocks but the problem is that I now have a huge list of TextBlocks, and I doubt the only way to do it is by typing each Textblock's name. If anyone could clarify how they would handle this? Simple solutions would be preffered, I'm a novice programmer and this is for a school project.
If you need to refer to a lot of controls you could group them in a single control (stackpanel, grid, ...) and access the controls by enumerating the child controls of the container.
An alternative is to use data binding. That way you probably don't need to refer to the controls at all.