Using the PopupButton from within a WPFToolkit DataGrid immediately closes the popup

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 6 years ago by Matt Swanton
Version: 13.1.0581
Environment: Windows 8 (64-bit)
Avatar

Hi,

I am using the PopupButton from within a DataGrid column.  When the popup is opened, it immediately closes again.  Interestingly, this only happens if you click the PopupButton using the left mouse button - using the right mouse button works fine.

Does anyone have any ideas?

<Controls:DataGrid x:Name="TestDataGrid"
                    AutoGenerateColumns="False"
                    CellEditEnding="TestDataGrid_CellEditEnding">
    <Controls:DataGrid.Columns>
        <Controls:DataGridTemplateColumn Header="Test Column">
            <Controls:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <Shared:PopupButton Content="Test" >
                        <Shared:PopupButton.PopupMenu>
                            <ContextMenu>
                                <MenuItem Header="Option 1" />
                                <MenuItem Header="Option 2" />
                            </ContextMenu>
                        </Shared:PopupButton.PopupMenu>
                    </Shared:PopupButton>
                </DataTemplate>
            </Controls:DataGridTemplateColumn.CellTemplate>
        </Controls:DataGridTemplateColumn>
    </Controls:DataGrid.Columns>
</Controls:DataGrid>

Comments (2)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Matt,

It looks like something outside our code (in WPF's core Windows message handling) is telling the popup to close in your scenario.  I did note that you can work around this problem by setting PopupButton.IsPreviewMouseDownHandled = true though.


Actipro Software Support

Posted 6 years ago by Matt Swanton
Avatar

Hi,

Thanks for the reply.  I have tested the work around and it solves the problem.

Many thanks.

The latest build of this product (v2018.1 build 0675) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.