Ошибка при попытке нажать на элемент в сетке.У меня есть такой установщик стиля:
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GridViewItem">
<ListViewItemPresenter x:Name="Root" ContentTemplate="{StaticResource CompletedDataTemplate}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Item"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" To="1.15" BeginTime="00:00:00.2000000"/>
<DoubleAnimation Duration="00:00:00.4" Storyboard.TargetName="Item" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" To="1.15" BeginTime="00:00:00.2000000"/>
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetName="grid" Storyboard.TargetProperty="(FrameworkElement.Width)">
<EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="471"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="DisabledStates">
<VisualState x:Name="Enabled"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ListViewItemPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
А также у меня есть такой шаблон данных:
<DataTemplate x:Key="CompletedDataTemplate">
<Grid x:Name="Item" Width="471" Height="303">
<Grid Height="265" VerticalAlignment="Top">
<Image Stretch="Fill" Source="../Assets/Fantastic-Full-HD-Wallpaper.jpg"/>
</Grid>
<TextBlock x:Name="textBlock" Height="20" TextAlignment="Center" Text="{Binding Name}" FontSize="21" FontFamily="../Assets/Fonts/GothamPro.ttf#Gotham Pro" Foreground="White" TextLineBounds="TrimToCapHeight"
VerticalAlignment="Bottom"/>
<Grid x:Name="grid" HorizontalAlignment="Left" Height="267" VerticalAlignment="Top" Width="0" Opacity="20">
<Grid.Background>
<AcrylicBrush TintColor="Black" TintOpacity="200"/>
</Grid.Background>
<TextBlock FontSize="64" Text="Open" Foreground="White" TextAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Grid>
</Grid>
</DataTemplate>
И когда я запускаю свое приложение, шаблоны и привязка работают отлично, но я не знаюкак установить целевое имя раскадровки для моих элементов шаблона данных.Любая идея?Может быть, я должен использовать другое решение?
В общем, у меня такая проблема: мне нужно использовать разные стили в моем виде сетки и разные шаблоны данных.Я уже пытался использовать визуальные состояния в моем шаблоне данных, но, похоже, это не сработало.