Adding button to group header

1 posts, 0 answers
  1. Avi
    Avi avatar
    25 posts
    Member since:
    Oct 2010

    Posted 03 May 2012 Link to this post

    Hello,

    I created a Group:

    <telerik:RadGridView Grid.Row="4" Grid.Column="1" Margin="0,5" ItemsSource="{Binding MatchedReferences}">
        <telerik:RadGridView.GroupHeaderTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="60"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Foreground="#1044AD" Text="{Binding Group.Key}"/>
                    <telerik:RadButton Grid.Column="1" x:Name="DeleteButton2" Height="20"
                    Command="{Binding DeleteMatchCommand}"
                    Content="{Binding AppStrings.Delete, Source={StaticResource StringsLocator}}">
                    </telerik:RadButton>
                </Grid>
            </DataTemplate>
        </telerik:RadGridView.GroupHeaderTemplate>
        ...
         
        <telerik:RadGridView.Columns>
            ...    
            <telerik:GridViewDataColumn DataMemberBinding="{Binding MatchId}" IsVisible="False"/>                                                    
        </telerik:RadGridView.Columns>
        <telerik:RadGridView.GroupDescriptors>
            <telerik:GroupDescriptor Member="MatchId" />
        </telerik:RadGridView.GroupDescriptors>


    public RelayCommand<string> DeleteMatchCommand { get; protected set; }
      
    DeleteMatchCommand = new RelayCommand<string>((matchId) => ExecuteDelete(matchId));
      
    private void ExecuteDelete(string matchId)
    {
    }

    But the problem is that by clicking the "delete" button the ExecuteDelete event has NOT been fired. When I put the "delete" button outside of GroupHeaderTemplateand and click in at runtime  there's no problem. the event is fired and the  ExecuteDelete method is executed. Why is this?

    With regards
Back to Top