geting information from Treeview with HierarchicalDataTemplate
- by lina
Good day!
I have such a template:
 <common:HierarchicalDataTemplate x:Key="my2ndPlusHierarchicalTemplate" ItemsSource="{Binding Children}">
                    <StackPanel Margin="0,2,5,2" Orientation="Vertical" Grid.Column="2">
                        <CheckBox
                        IsTabStop="False"
                        IsChecked="False"
                        Click="ItemCheckbox_Click"
                        Grid.Column="1"
                        />
                        <TextBlock Text="{Binding Name}" FontSize="16"  Foreground="#FF100101" HorizontalAlignment="Left" FontFamily="Verdana" FontWeight="Bold" />
                        <TextBlock Text="{Binding Description}" FontFamily="Verdana" FontSize="10" HorizontalAlignment="Left"  Foreground="#FFA09A9A" FontStyle="Italic" />    
<TextBox Width="100" Grid.Column="4" Height="24" LostFocus="TextBox_LostFocus" Name="tbNumber"></TextBox>
</StackPanel>
        </common:HierarchicalDataTemplate> 
for a  Treeview
<controls:TreeView x:Name="tvServices" ItemTemplate="{StaticResource myHierarchicalTemplate}" ItemContainerStyle="{StaticResource expandedTreeViewItemStyle}" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" BorderBrush="#FFC1BCBC" FontFamily="Verdana" FontSize="14">                       
        </controls:TreeView>
I want to know the Name property of each TextBox in Treeview to make validation of each textbox such as:  
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            tbNumber.ClearValidationError();
            if ((!tbNumber.Text.IsZakazNumberValid()) && (tbNumber.Text != ""))
            {
                tbNumber.SetValidation(MyStrings.NumberError);
                tbNumber.RaiseValidationError();
                isValid = false;
            }
            else
            {
                isValid = true;
            }
        }
and I wnat to see what check boxes were checked
how can I do it?