Search code examples
xamlwinui-3

DataGrid Flyout on entire datagrid, not just row?


What's the correct way of having it possible to right click to open the menuflyout anywhere in the datagrid, not just on rows? If there are no rows in the datagrid, I still want the user to be able to show the flyout.


Solution

  • To anyone having this same issue, the answer is to set a background(it can be transparent) to the datagrid. That makes the flyout clickable and showable all over. Also, instead of using RowSTyle:

    <Style TargetType="dataGridControl:DataGridRow">
          <Setter Property="dataGridControl:DataGridRow.ContextFlyout">
    

    Use:

      <Style TargetType="dataGridControl:DataGrid">
             <Setter Property="dataGridControl:DataGrid.ContextFlyout">
                 <Setter.Value>