ListViewのマウスオーバー時・選択時の色を消す
2021-03-14
MainWindow.xaml
<Window x:Class="WpfApp8.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp8"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<ListView ItemsSource="{Binding Path=ArrayData}">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<!-- ボーダーの設定 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- 選択時の背景色 -->
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Window>
関連記事
ListViewのスクロールをPixel単位にする
VirtualizingPanel.ScrollUnit="Pixel" を設定 ...
ListViewを横並びにする
MainWindow.xaml <Window x:Class="WpfA ...
ListViewの中身の幅をいっぱいに広げる
MainWindow.xaml <Window x:Class="WpfA ...
[VisualStudio2019]BlendSDKからMicrosoft.Xaml.Behaviors.Wpfへ移行
VisualStudio2019から、BlendSDKが提供されなくなった為、M ...
Material Design In XAML ToolkitのComboBoxを旧型式にする
コンボボックスにMaterial Design In XAML Toolkitを ...
ディスカッション
コメント一覧
まだ、コメントがありません