Я в настоящее время в проекте C# WPF и я отображать изображения в несколько рядов (синие головы)Как обрабатывать события выбора с WrapPanel
Проблема заключается в том, что я не могу выбрать любой из этих элементов, я использую шаблон MVVM, поэтому код должен быть как можно более легким, и я должен делать все, что могу, в файле xaml.
Поэтому я хотел был бы иметь возможность выбрать изображения, щелкнув на них, я попытался использовать событие, подобное «IsMouseOver», но я смог изменить всю оболочку, а не отдельные элементы.
Вот код, я использую:
<Grid Grid.Row="1" Height="Auto">
<Grid.Background>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="#252525" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Grid.Background>
<ItemsControl Background="Transparent" Foreground="AntiqueWhite" BorderBrush="Transparent"
HorizontalContentAlignment="Stretch" ItemsSource="{Binding Source={x:Static Context:Session.CurrentSession}, Path=CurrentProject.Models}">
<ItemsControl.ContextMenu>
<ContextMenu>
<MenuItem Header="Delete" Command="{Binding DeleteModel3DCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"/>
</ContextMenu>
</ItemsControl.ContextMenu>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectModel3DCommand}" CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="/McKineap;component/Resources/Images/logo-mckineap.png" Height="100"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
я буду принимать какие-либо предложения, которые вы могли бы о правильном пути, чтобы определить избранное событие в моей WrapPanel, спасибо за ваше время!
Awsome спасибо! – Folder