2012-01-13 41 views
1

是否可以使用通配符在XAML(Silverlight)中查找控件?是否可以使用通配符在XAML(Silverlight)中查找控件?

防爆..在我的XAML

<TextBlock Text="Title" Grid.Row="0" Grid.Column="0" Style="{StaticResource txtBlock}" /> 
      <TextBox x:Name="uxTitle" Grid.Row="0" Grid.Column="1" IsReadOnly="{StaticResource IsControlReadOnly}" 
        Text="{Binding Title, Mode=TwoWay}" Style="{StaticResource txtBox}" Width="100"/> 

      <TextBlock Text="Firstname" Grid.Row="1" Grid.Column="0" Style="{StaticResource txtBlock}" /> 
      <TextBox x:Name="uxFirstName" Grid.Row="1" Grid.Column="1" 
        Text="{Binding FirstName, Mode=TwoWay}" Style="{StaticResource txtBox}" Width="250"/> 

      <TextBlock Text="Middlename" Grid.Row="2" Grid.Column="0" Style="{StaticResource txtBlock}" /> 
      <TextBox x:Name="uxMiddleName" Grid.Row="2" Grid.Column="1" 
        Text="{Binding MiddleName, Mode=TwoWay}" Style="{StaticResource txtBox}" Width="250"/> 

在代碼隱藏

public void searchControl() 
{ 
     this.LayoutRoot.FindName("ux*"); 

     // Or like this way 
     this.LayoutRoot.FindName("ux???"); 
} 

回答

相關問題