Closed GuilhermeRaposo closed 6 months ago
How do I invoke a command when a listbox item is double clicked?
<ListBox Items="{ Binding Accounts }" SelectedItem="{ Binding SelectedAccount }" ScrollViewer.VerticalScrollBarVisibility="Visible" Grid.Row="2"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock x:Name="{ Binding AccountName }" Text="{ Binding AccountName }"> <i:Interaction.Behaviors> <ia:EventTriggerBehavior EventName="DoubleTapped" SourceObject="{ Binding AccountName }"> <ia:InvokeCommandAction Command="{ Binding Login }" /> </ia:EventTriggerBehavior> </i:Interaction.Behaviors> </TextBlock> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
This doesn't seem to work, but if I wrap the behavior inside a Button and change the SourceObject to the button it works normally.
How do I invoke a command when a listbox item is double clicked?
This doesn't seem to work, but if I wrap the behavior inside a Button and change the SourceObject to the button it works normally.