작동하지 않습니다, 그것은 단지 작동 당신은 스크린 샷에서 볼 수 있습니다하이라이트 목록보기 항목이 제대로
원본 강조 (더 스타일이 적용되지와 함께) : 사용자 정의 ItemContainerStyle이
을 적용하이라이트
<Style x:Key="DetailStyle" TargetType="{x:Type ListView}">
<Setter Property="l:ListBoxSelector.Enabled" Value="True"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource DetailViewStyle}"/>
<Setter Property="View">
<Setter.Value>
<GridView AllowsColumnReorder="True">
<GridViewColumn Width="30" CellTemplate="{StaticResource columnIconDT}"/>
<GridViewColumn Header="Name" Width="100" CellTemplate="{StaticResource columnNameDT}"/>
<GridViewColumn Header="Size" Width="100" CellTemplate="{StaticResource columnSizeDT}"/>
</GridView>
</Setter.Value>
</Setter>
</Style>
ItemContainerStyle : 사용자 정의 ItemContainerStyle은 ListView에 스타일
(마우스 ContentPresenter
이상) 적용는
하이라이트
<Style x:Key="DetailViewStyle" TargetType="{x:Type ListViewItem}">
<EventSetter Event="ContextMenu.ContextMenuOpening" Handler="Item_ContextMenuOpening"/>
<EventSetter Event="PreviewMouseDoubleClick" Handler="Item_MouseDoubleClick"/>
<Setter Property="Margin" Value="0,0,0,-1"/>
<Setter Property="ContextMenu" Value="{DynamicResource ContextMenuForItem}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid HorizontalAlignment="Stretch">
<Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="2.5"/>
<GridViewRowPresenter x:Name="gridrowPresenter" Content="{TemplateBinding Property=ContentControl.Content}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#33C1DEFF" Offset="0"/>
<GradientStop Color="#41A5CDFF" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="border" Value="#FF7DA2CE"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#FF7DA2CE"/>
<Setter Property="Background" TargetName="border">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#97C1DEFF" Offset="0"/>
<GradientStop Color="#A7A5CDFF" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="Selector.IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" TargetName="border" Value="#FFB4B4B4"/>
<Setter Property="Background" TargetName="border">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#7FE5E5E5" Offset="0"/>
<GradientStop Color="#B2CCCCCC" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
어떻게 해결할 수 있습니까?
피할 수도 있음 –