Command association with Button inside Listview

Nov 4, 2008 at 5:25 PM

I'm using the Composite WPF for an application and its really nice. I'm using the Presentation model for development.
I'm having an issue with binding a Command (exposed by the Model) to a button which is inside a listview.
<ListView Margin="10,5,10,5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding RecordItemSource}" IsTabStop="True">
        <GridView AllowsColumnReorder
            <GridViewColumn Header="Date" Width="72" DisplayMemberBinding="{Binding Path
=Incident.Date}" />
            <GridViewColumn Header="Status" Width="75" DisplayMemberBinding="{Binding Path=StatusID, Converter={StaticResource StatusConverter
}}" />
            <GridViewColumn Header="User" Width="75" DisplayMemberBinding="{Binding Path
=Timestamp.CreatedBy}" />
            <GridViewColumn Header="Remove" Width="75" CellTemplate="{StaticResource RemoveButtonTemplate
}" />

The datatemplate for the "Remove" column is as below.



DataTemplate x:Key="RemoveButtonTemplate">
<Button Style="{DynamicResource deleteButton}" Command="{Binding Path=RemoveCommand}" CommandParameter="{Binding Path=SomeID}"/>

The problem is that when the remove button is clicked, the command does not trigger. If its associated to a control oustide the Listview... It Works!! Not sure exactly as what is being done wrong.
Could anyone please help on this? I'm just starting my WPF experience... :)







Nov 4, 2008 at 8:44 PM
Thanks .. But I got it correct ... It was a mistake on my side in the binding I made