views:

331

answers:

1

Hi,

I Have a listbox defined like below :

<ListBox x:Name="lstMedias" ItemsSource="{Binding Medias}" Width="Auto" Height="Auto">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Button Content="{Binding Name}" Tag="{Binding Name}" Click="Button_Click" Command="{Binding Path=LoadSimpleMoviePopupCommand}">
                <Button.Resources>
                    <Converters:LoadMovieMultiConverter x:Key="LoadMovieMultiConverter" />
                </Button.Resources>                                    
                <Button.CommandParameter>
                    <MultiBinding Converter="{StaticResource LoadMovieMultiConverter}">
                        <MultiBinding.Bindings>
                            <Binding ElementName="DragDropCanvas" />
                            <Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
                        </MultiBinding.Bindings>
                     </MultiBinding>
                 </Button.CommandParameter>
              </Button>
          </DataTemplate>
      </ListBox.ItemTemplate>
</ListBox>

When Trying to call command LoadSimpleMoviePopupCommand, command is not called, but when calling click event, event is raised.

Do You have an idea why ? It is a normal behavior ? Do we have to trick like ListBoxItem doubleclick ?

+1  A: 

Probably because the binding failed. Check the output window of VS and see if there are any binding errors. I suspect the LoadSimpleMoviePopupCommand property is not on your data item class (ie. your Media class).

HTH,
Kent

Kent Boogaart
I was thinking like you, but I tried to put a button outside the listbox, and it works! So, it means that it is not a binding issue, but something in relation to the listbox!
DavidP