This is a migrated thread and some comments may be shown as answers.

Adding button to group header

0 Answers 168 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Avi
Top achievements
Rank 1
Avi asked on 03 May 2012, 03:49 PM
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
Tags
GridView
Asked by
Avi
Top achievements
Rank 1
Share this question
or