我有以下XAML但我似乎无法访问相应.CS文件中ItemsWrapGrid的内容 - 任何人都可以告诉我应该做什么(这里是后面的代码和xaml ):
private void wifiTapped(object sender, TappedRoutedEventArgs e)
{
Debug.WriteLine("in here " + e.GetType().ToString());
ItemsWrapGrid wg = (ItemsWrapGrid) sender;
Debug.WriteLine(e.OriginalSource.ToString());
foreach (Control c in wg.Children)
{
Debug.WriteLine("Control " + c.Name);
}
Debug.WriteLine("leaving ");
}
<GridView VerticalAlignment="Top" ItemsSource="{Binding nets}" x:Name="GDView" ItemClick="gdViewClick" >
<GridView.ItemTemplate>
<DataTemplate x:Name="configDataTemplate" x:DataType="data:wifiNets" >
<StackPanel Height="300" Width="350" Margin="10" Name="dtStackPanel" >
<Image Source="Assets\wifiIcon.png" Width="200" Height="201" />
<StackPanel Orientation="Horizontal">
<TextBlock Text="Name" Margin="0,0,10,0"/>
<TextBlock Name="configSSID" Width="auto" Text="{x:Bind NetSSID}" FontSize="24" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Strength" Margin="0,0,10,0"/>
<!--<TextBlock Name="configStrength" Width="auto" Text="{x:Bind NetSSIDStrength}" FontSize="20" />-->
<ProgressBar Name="configProgBar" Maximum="5" Value="{x:Bind NetSSIDStrength}" Foreground="Green" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Connected" Margin="0,0,10,0"/>
<TextBlock Name="configConnectedTo" Text="{x:Bind NetSSIDConnected}" FontSize="20"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="10" Orientation="Vertical" Tapped="wifiTapped" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
为了清楚起见,当我运行这个时,我有三项数据(因此它正在工作) - 但我希望能够做的就是点击三个数据中的任何一个项目,并能够在数据面板中识别各个控件及其值。
先谢谢,这让我疯了。 保罗。