0
У меня есть ListView WPF, содержащий другой UserControl. Он отлично работает, но я не могу удалить выделение и выделение мыши blu.WPF ListView remove mouseover higligth
Вот код:
<UserControl.Resources>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border
BorderBrush="Transparent"
BorderThickness="0"
Background="{TemplateBinding Background}">
<GridViewRowPresenter HorizontalAlignment="Stretch" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto" Margin="0" Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate DataType="{x:Type vm:ElementViewModel}" x:Key="ElementTemplate">
<vw:ElementView />
</DataTemplate>
</UserControl.Resources>
<GroupBox Header="{x:Static Translate:Translate.CreateLoop}">
<ListView ItemsSource="{Binding Path=ElementList, UpdateSourceTrigger=PropertyChanged}"
ItemTemplate="{StaticResource ElementTemplate}"
Background="{StaticResource EnvLayout}"
BorderBrush="Transparent">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Resources>
<!--Foreground for Selected ListViewItem-->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/>
<!--Background for Selected ListViewItem-->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="ItemBackgroundHover" Color="Transparent"/>
</Style.Resources>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</GroupBox>
DataTemplate используется, чтобы связать вид с соответствующим ViewModel. Здесь мышь над стилем я хотел бы, чтобы удалить
Great! Он работает точно так, как я ожидаю! – andrea