Hi,
Here you are checking for the name of the control.In this case you should add a name to the control when you are adding to the grid.
<Grid Name="Grid1">
<Button Name="Button1" Height="35" VerticalAlignment="Top" Margin="0,0,65,0" />
<CheckBox Height="16" Margin="53,86,105,0" Name="checkBox1" VerticalAlignment="Top">CheckBox</CheckBox>
<ComboBox Height="23" Margin="59,0,99,74" Name="comboBox1" VerticalAlignment="Bottom" />
</Grid>
Here i have added some elements to the grid.
foreach (FrameworkElement objelement in Grid1.Children)
{
if (objelement.Name == "comboBox1")
{
MessageBox.Show("Combo Found");
}
}
Actually in this case what are you trying to do?
Hope it helps
Please mark posts as answers/helpful if it answers your query.
This would be helpful for others facing the same kind of problem