आप ऐसा कर सकते हैं। प्रत्येक पृष्ठ में UIElements
का कंटेनर होगा, इसलिए मैं Grid
का उपयोग कर रहा हूं। आप StackPanel
के साथ भी ऐसा ही कर सकते हैं। मैं अपने बच्चों के माध्यम से उत्साहित हूं और यह जांच रहा हूं कि यह Textbox
है या नहीं।
XAML
<Grid x:Name="rootGrid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<TextBox Height="51" Margin="210,103,0,0" Text="TextBox" Width="135"/>
<TextBox Height="51" Margin="459,149,0,0" Text="TextBox" Width="135"/>
<TextBox Height="51" Margin="277,279,0,0" Text="TextBox" Width="135"/>
<TextBox Height="51" Margin="580,279,0,0" Text="TextBox" Width="135"/>
<TextBlock Height="63" Margin="227,494,0,0" Text="TextBlock" Width="142"/>
<TextBlock Height="63" Margin="479,469,0,0" Text="TextBlock" Width="142"/>
<TextBlock Height="63" Margin="573,406,0,0" Text="TextBlock" Width="142"/>
<TextBlock Height="63" Margin="143,352,0,0" Text="TextBlock" Width="142"/>
<CheckBox Content="CheckBox" Height="81" Margin="1064,203,0,0" Width="130"/>
<CheckBox Content="CheckBox" Height="81" Margin="713,119,0,0" Width="130"/>
<CheckBox Content="CheckBox" Height="81" Margin="831,352,0,0" Width="130"/>
</Grid>
सी #
protected override void OnNavigatedTo(NavigationEventArgs e)
{
foreach (var child in rootGrid.Children)
{
if (child is TextBox)
{
System.Diagnostics.Debug.WriteLine(((TextBox)child).Text);
if (string.IsNullOrEmpty(((TextBox)child).Text))
{
//Empty text in this box
}
}
}
}
सही उत्तर को चिह्नित करने के लिए इसे विनम्र माना जाता है। –