按钮在RadGridView编辑模板内的弹出窗口上不起作用-WPF

时间:2019-05-17 18:41:31

标签: wpf button popup radgridview celleditingtemplate

用于WPF,RadGridView的Teleelerik UI。

在xaml中,我在放置在“编辑单元格模板”(CellEditTemplate)上的弹出窗口中有一个按钮。当我单击按钮时,不会触发按钮的Click事件和Command。我尝试将弹出式窗口与按钮放置在“查看单元格模板”(CellTemplate)内,并将按钮本身(没有弹出窗口)置于“编辑模板”内。他们俩都在工作。 xaml结构如下。单击弹出窗口上的按钮时,我想关闭弹出窗口并继续将更改提交到单元格上。这可能吗?这是Telerik特有的问题还是GridView的常见问题?

预先感谢您的帮助。

<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">
                                            </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>

0 个答案:

没有答案