Hello, as it says in the title, I would like to change the color inside or the content of the gird as soon as it is selected.
The code below is the current situation I am using as a compromise solution, but here the whole item is colored and not only the gird.
I've tried a lot of different things, but haven't come up with a good solution yet.
<UserControl x:Class="MyApp.WPF.Pages.User.AthletesOverviewView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MyApp.WPF.Pages.User"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="ListViewItem">
<Setter Property="Background" Value="Green"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Center">
<Button Margin="5" Content="Add" MinWidth="50" Command="{Binding AddNewAthlet}"/>
<Button Margin="5" Content="Details" MinWidth="50" Command="{Binding DetailsAthlet}"/>
<Button Margin="5" Content="Modify" MinWidth="50" Command="{Binding ModifyAthlet}"/>
<Button Margin="5" Content="CurrentAthlet" MinWidth="50" Command="{Binding DeleteAthlet}"/>
<Button Margin="100 5 5 5" Background="OrangeRed" Content="Delete" MinWidth="50" Command="{Binding DeleteAthlet}"/>
<TextBlock Margin="50 5 5 5" Text="{Binding HeadLastName, UpdateSourceTrigger=PropertyChanged}" MinWidth="50" Background="LightGray"/>
</WrapPanel>
<ListView ItemsSource="{Binding AllAthletesItemViewModels}"
SelectedItem="{Binding SelectedAllAthletesItemViewModel}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Grid.Row="1">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Border Height="200" Width="200"
BorderBrush="Orange" BorderThickness="1"
CornerRadius="10" Padding="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<local:AllAthletesItemView />
<!--<TextBlock Text="{Binding FirstName}"/>-->
<TextBlock Grid.Row="1" Text="{Binding LastName}"/>
</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</UserControl>
As you can see in the picture the red goes beyond the golden border and it should not be like that, the red should only be inside the golden border.
It would also be perfect if you can turn off the mousover ("the blue") effect but I think I can do that myself. :)