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

Button is not working on popup inside RadGridView CellEditTemplate

1 Answer 190 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Toan
Top achievements
Rank 1
Toan asked on 17 May 2019, 05:51 PM
<telerik:RadGridView ... NewRowPosition="Top">
    <telerik:RadGridView.Columns>
        <telerik:GridViewToggleRowDetailsColumn .../>
        <telerik:GridViewDataColumn ...>       
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                ...            
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>         
            <telerik:GridViewDataColumn.CellEditTemplate>
                <DataTemplate>
                    <TextBox ... >
                        <TextBox.Triggers>
                            <EventTrigger RoutedEvent="TextBox.GotFocus">
                                <EventTrigger.Actions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <BooleanAnimationUsingKeyFrames
                                                 Storyboard.TargetName="TextBoxPopup"
                                                 Storyboard.TargetProperty="IsOpen">
                                                <DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True" />
                                            </BooleanAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger.Actions>
                            </EventTrigger>
                        </TextBox.Triggers>
                    </TextBox>
                     
                    <Popup x:Name="TextBoxPopup" ...>          
                        ...
                        <Button Content="Test Button"
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}},Path=DataContext.SaveCommand}"
                                Click="Button_Click"/>
                        <Popup.Triggers>
                            <EventTrigger RoutedEvent="Popup.LostFocus">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <BooleanAnimationUsingKeyFrames
                                             Storyboard.TargetName="TextBoxPopup"
                                             Storyboard.TargetProperty="IsOpen">
                                            <DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
                                        </BooleanAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Popup.Triggers>
                    </Popup>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
        </telerik:GridViewDataColumn>               
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.RowDetailsTemplate>
        ...
    </telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>

Hi,

In xaml, I have a button inside a popup that is placed on edit cell template (CellEditTemplate). The button's Click event and the Command are not fired when I click the button.  I have tried placing the popup with the button inside view cell template (CellTemplate) and the button by itself (no popup) inside edit template.  They are both working.  The xaml structure is attached.  When the button on the popup is clicked, I want to close the popup and proceed to commit the change on the cell.  Is this possible to do? 

Thank you in advance for your help.

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 22 May 2019, 08:32 AM
Hello Toan,

I've tested your code, but I couldn't reproduce the issue. Both the command and the event are firing. Can you check the attached project and let me know if I am missing something?

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Toan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or