The DataGrid style does not allow to open the ContextMenu. Having established the developed style for the DataGrid, ContextMenu stopped opening.
When I delete the Style DataGrid - the context menu opens - everything works correctly. Therefore, the error is looking for in the Style.
Tried to substitute a TemplateBinding ContextMenu in any department of the tree interface DataGridRow. Unsuccessfully.
...
<Style x:Key="Private.DataGridRow" TargetType="{x:Type DataGridRow}">
<Setter Property="Controls:DataGridRowHelper.SelectionUnit" Value="{Binding Path=SelectionUnit, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
<Setter Property="ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<TextBlock Foreground="#d50000" Margin="2,0,0,0" Text="!" VerticalAlignment="Center"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Border x:Name="DGR_Border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
<SelectiveScrollingGrid>
<SelectiveScrollingGrid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</SelectiveScrollingGrid.ColumnDefinitions>
<SelectiveScrollingGrid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</SelectiveScrollingGrid.RowDefinitions>
<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>
<DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</SelectiveScrollingGrid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
...
What DataGrid looks like
<DataGrid Grid.Column="0"
ItemsSource="{Binding ItemsCustomer}"
Style="{StaticResource AtlantUI.DataGrid.Ghost}"
SelectedItem="{Binding SelectedCustomer}"
AutoGenerateColumns="False"
CanUserSortColumns="True"
CanUserAddRows="False"
SelectionUnit="FullRow"
SelectionMode="Single"
Core:DataGridHelper.CellPadding="8 4 4 4"
Core:DataGridHelper.ColumnHeaderPadding="4"
Margin="5,0,5,5">
Work with ContextMenu. This ContextMenu should open when selecting the DataGrid row.
<DataGrid.Resources>
<ContextMenu x:Key="ctx_menu" DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
<MenuItem Command="{Binding DataContext.RemoveCommand}"
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"
Header="Remove" />
</ContextMenu>
</DataGrid.Resources>
<DataGrid.ItemContainerStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="ContextMenu" Value="{StaticResource ctx_menu}" />
</Style>
</DataGrid.ItemContainerStyle>
How should work. When choosing DataGridRow opens the context menu. Thanks all.