In a ListView
control by de开发者_运维知识库fault you select a row if you click on the content of a column but if you click on the row out of bounds of content then it wont select the row. Is there any quick way to do it expect specifying templates for each column?
I've tried (this actually works for ListBox ):
<Style TargetType="{x:Type ListViewItem}"
BasedOn="{StaticResource {x:Type ListViewItem}}">
<Setter Property="Background" Value="#01000000" />
</Style>
I had a similar problem with ListView (did not test it with ListBox). Hopefully this will apply. I know this is not a tested answer but I cannot post code in a comment. If it does not work please let me know and I will remove it.
<ListView ... >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
...
精彩评论