I have a list with a data table for items. The problem is that selecting an item does not work by simply clicking anywhere on the item; I have to click on a specific subitem so that it really works.
My item has an image and a text block. If I hover over an image or text block, I actually see a hover effect. If I hover over any "empty" space of an element, there is no freezing effect (and no choice when I click there).
Image example: http://i33.tinypic.com/wvtleg.png
If I click (or hover) the actual text or image, it works fine, but if I find the mouse in empty areas (I drew a red line around it :)), the list does not respond.
How to get a freeze / click list to respond to a click anywhere in the item space?
For completeness, my Listbox + template is presented:
<ListBox Grid.Row="1" ItemsSource="{Binding Path=CreatableOutputWindows, Mode=OneWay}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8,8,8,8" Name="listBox1" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="84"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Border Margin="5" BorderBrush="Black" BorderThickness="2"> <Image Source="{Binding Path=Image}" Stretch="Fill" Width="80" Height="50" /> </Border> <StackPanel Grid.Column="1" Margin="5"> <StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold"> <TextBlock Text="{Binding Path=Name}" /> </StackPanel> </StackPanel> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
wpf hover listbox selection
Pygmy
source share