Как я могу получить (или пропустить) все элементы в gridview? После XAML генерирует сетку из элементов, которые являются tappable/интерактивныхПолучить элементы в GridView Windows 8
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemsGridView"
AutomationProperties.Name="Items"
TabIndex="1"
Grid.RowSpan="2"
Padding="116,136,116,46"
ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
SelectionMode="None"
IsSwipeEnabled="false">
<GridView.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left" Width="250" Height="250" Tapped="Grid_Tapped" RightTapped="Grid_RightTapped">
<Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding ImageURL}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{ThemeResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock Text="{Binding Name}" Foreground="{ThemeResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource BaseTextBlockStyle}" Height="60" Margin="15,0,15,0" FontWeight="SemiBold"/>
<TextBlock Text="{Binding CurrentState}" Foreground="{ThemeResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource BaseTextBlockStyle}" TextWrapping="NoWrap" Margin="15,0,15,10" FontSize="12"/>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
мне нужно, чтобы иметь возможность петлю через каждый из этих элементов и обновлять их значение. Это, как я пытаюсь это сделать, но не может
foreach (var item in itemGridView.Items)
{
var _Container = itemGridView.ItemContainerGenerator.ContainerFromItem(item);
//Once i have the contrainer i know i can access its childern but this line of code throws error
}
Есть ли способ, чтобы быть в состоянии делать то, что я хочу сделать здесь?
Или если в Windows 8 есть событие RowDataBound как событие?
возвращает нуль. – Salman