Button is not working on popup inside RadGridView CellEditTemplate

2 posts, 0 answers
  1. Toan
    Toan avatar
    1 posts
    Member since:
    Apr 2019

    Posted 17 May Link to this post

    <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.

     

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2217 posts

    Posted 22 May Link to this post

    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.
Back to Top