Button in ListBoxItem not firing event
See original GitHub issueHello, I am trying to place a button inside a ListViewItem like this:
<ListBox FontSize="13" Items="{Binding Path=SelectedFPGA.Connections}" SelectedItem="{Binding Path=SelectedFPGA.SelectedConnection, Mode=TwoWay}" Background="{StaticResource DarkColor}" BorderThickness="0" VerticalAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding Signal}"></TextBlock>
<Image Height="18" Source="avares://VHDPlus/Assets/Images/Icons/twotone_link_white_18dp.png"></Image>
<TextBlock Text="{Binding Pin}"></TextBlock>
<Button Height="18" Width="18" Classes="Seperate" DockPanel.Dock="Right" Command="{Binding Seperate}" HorizontalAlignment="Right" ToolTip.Tip="Seperate connection" Margin="0" Padding="0">
<Image Height="18" Source="avares://VHDPlus/Assets/Images/Icons/Close_White_16x.png"></Image>
</Button>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
It shows correcty but I can’t figure out how to get the click event from it. The :pointerover style does not work too so I am guessing that the Listboxitem consumes the click so the button does not fire the event.
I tried experimenting with Z-Index but it didn’t change anything
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Button event is not triggered from Listbox item template wpf
button event is not triggered in code behind or in viewmodel with command binding. How to fix this? wpf · listbox · buttonclick...
Read more >dblclick event in listbox not firing - Forums
I have an issue with the dblclick event not firing immediately from my listbox. It does eventually fire if i mash the mouse...
Read more >[Solved] WPF ListBox itemtemplate and Button press events
Normally with button click events I just chooce listboxitem and then I press its button but now I cant press listbox item because...
Read more >UWP - ListBox Scroll Mouse Released Event not Found
I have Simple Listbox Inside a Grid ...ScrollBar is working fine, But I need a Event to Raise when ScrollBar Mouse Released Event....
Read more >Listbox onSelect event does not fire
I want to do it in MVC but I can't figure it out the function isn't called I tried specifing the path but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know what is wrong here but in I managed to make it work in a different ListBox so I guess it was my mistake
@Touhid9814 answering closed issues will most likely not help you. If you have a question you need an advice, please open a new Q&A in discussion or join us on telegram https://t.me/Avalonia