I have a StackPanel
with some WrapPanel
. inside each WrapPanel
located two element:
<StackPanel FlowDirection="RightToLeft" Grid.Column="2" Grid.Row="1" Name="check_boxes_layout">
<WrapPanel>
<CheckBox Name="chk1" Checked="Checked_Changed" Unchecked="Unchecked"></CheckBox>
<Rectangle Width="50" Fill="Red" Name="rec1" Margin="10 2 2 2"/>
</WrapPanel>
<WrapPanel>
<CheckBox Name="chk12" Checked="Checked_Changed" Unchecked="Unchecked"></CheckBox>
<Rectangle Width="50" Fill="Blue" Name="rec2" Margin="10 2 2 2"/>
</WrapPanel>
<StackPanel/>
I want to get all children of type check box .how can i do this?
foreach (var item in check_boxes_layout.Children.OfType<CheckBox>())
{
//this code just return Wrap Panel
}
Thank You in Advance.