I have the following ListBox
:
<ListBox x:Name="SequencesFilesListBox" ItemsSource="{Binding SequencesFiles, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="DarkBlue" BorderBrush="Transparent" />
The SequencesFiles
defined as ItemsSource
is an ObservableCollection<Button>
.
I'm manually adding new Buttons
to the collections using the following function:
private void AddSequenceToPlaylist(string currentSequence)
{
if (SequencesFiles.Any(currentFile => currentFile.ToolTip == currentSequence)) return;
var newSequence = new Button
{
ToolTip = currentSequence,
Background = Brushes.Transparent,
BorderThickness = new Thickness(0),
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Stretch,
Content = Path.GetFileName(currentSequence),
Command = PlaylistLoadCommand,
CommandParameter = currentSequence,
};
SequencesFiles.Add(newSequence);
}
Is it possible to call the Command
(PlaylistLoadCommand
) upon double-click and not upon click?