To simplify the problem, I have the following XAML Windows :
<Window x:Class="WpfApplication1.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:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525"
DataContext="{StaticResource MainViewModel}">
<Grid>
<Button Click="Button_Click">Click Me</Button>
<ListBox ItemsSource="{Binding Items}" Background="{x:Null}">
</ListBox>
</Grid>
</Window>
When it runs it look like this :
What I would expect is:
- I'm able to select Items ( WpfApplication1.BusinessObject )
- AND also able click on the button ( as I marked Background as {x:Null} )
But I can't click on the button, only select items in the listbox. Note: If I use IsHitTestVisible, I can click on the button, but no more on the items, which makes sense. I also absolutely need to have both listbox and button taking the whole windows. Having on top the listbox and on bottom the button is not a solution.
Is there a good way to have this working ?
Thanks for your help !