edit
This commit is contained in:
@@ -452,7 +452,19 @@
|
|||||||
<MenuItem Header="Отменить проверку"
|
<MenuItem Header="Отменить проверку"
|
||||||
Command="{Binding ResetLineVerificationCommand}" />
|
Command="{Binding ResetLineVerificationCommand}" />
|
||||||
<MenuItem Header="Удалить"
|
<MenuItem Header="Удалить"
|
||||||
Command="{Binding DeleteSelectedLinesCommand}" />
|
Command="{Binding DeleteSelectedLinesCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Canvas Width="16" Height="16">
|
||||||
|
<Rectangle Canvas.Left="4" Canvas.Top="5" Width="8" Height="8" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="3" Canvas.Top="3" Width="10" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="1.5" Width="4" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
<Rectangle Canvas.Left="9" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
|
|||||||
@@ -44,6 +44,53 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
HeadersVisibility="Column">
|
HeadersVisibility="Column">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
|
||||||
|
<MenuItem Header="Добавить"
|
||||||
|
Command="{Binding AddCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Grid Width="16" Height="16">
|
||||||
|
<Ellipse Width="14" Height="14" Fill="{StaticResource AppMenuIconAccentBrush}" />
|
||||||
|
<Rectangle Width="2" Height="8" Fill="White" RadiusX="1" RadiusY="1" />
|
||||||
|
<Rectangle Width="8" Height="2" Fill="White" RadiusX="1" RadiusY="1" />
|
||||||
|
</Grid>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="Изменить"
|
||||||
|
Command="{Binding EditCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Canvas Width="16" Height="16">
|
||||||
|
<Path Fill="{StaticResource AppMenuIconAccentBrush}" Data="M11.7,1.4 L14.6,4.3 L5.5,13.4 L2.5,13.9 L3,10.9 Z" />
|
||||||
|
<Path Fill="#FFEAF3FB" Data="M10.7,2.4 L13.6,5.3 L12.8,6.1 L9.9,3.2 Z" />
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="Удалить"
|
||||||
|
Command="{Binding DeleteCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Canvas Width="16" Height="16">
|
||||||
|
<Rectangle Canvas.Left="4" Canvas.Top="5" Width="8" Height="8" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="3" Canvas.Top="3" Width="10" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="1.5" Width="4" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
<Rectangle Canvas.Left="9" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<EventSetter Event="PreviewMouseRightButtonDown"
|
||||||
|
Handler="DataGridRow_PreviewMouseRightButtonDown" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="ID"
|
<DataGridTextColumn Header="ID"
|
||||||
Width="90"
|
Width="90"
|
||||||
@@ -66,18 +113,6 @@
|
|||||||
Margin="0,12,0,0"
|
Margin="0,12,0,0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right">
|
HorizontalAlignment="Right">
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding AddCommand}"
|
|
||||||
Content="Добавить" />
|
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding EditCommand}"
|
|
||||||
Content="Изменить" />
|
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding DeleteCommand}"
|
|
||||||
Content="Удалить" />
|
|
||||||
<Button Width="90"
|
<Button Width="90"
|
||||||
IsCancel="True"
|
IsCancel="True"
|
||||||
Content="Закрыть" />
|
Content="Закрыть" />
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace XLAB2
|
namespace XLAB2
|
||||||
{
|
{
|
||||||
@@ -13,6 +15,16 @@ namespace XLAB2
|
|||||||
DataContext = _viewModel;
|
DataContext = _viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataGridRow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var row = sender as DataGridRow;
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
row.IsSelected = true;
|
||||||
|
row.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
await _viewModel.InitializeAsync();
|
await _viewModel.InitializeAsync();
|
||||||
|
|||||||
@@ -44,6 +44,53 @@
|
|||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
HeadersVisibility="Column">
|
HeadersVisibility="Column">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
|
||||||
|
<MenuItem Header="Добавить"
|
||||||
|
Command="{Binding AddCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Grid Width="16" Height="16">
|
||||||
|
<Ellipse Width="14" Height="14" Fill="{StaticResource AppMenuIconAccentBrush}" />
|
||||||
|
<Rectangle Width="2" Height="8" Fill="White" RadiusX="1" RadiusY="1" />
|
||||||
|
<Rectangle Width="8" Height="2" Fill="White" RadiusX="1" RadiusY="1" />
|
||||||
|
</Grid>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="Изменить"
|
||||||
|
Command="{Binding EditCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Canvas Width="16" Height="16">
|
||||||
|
<Path Fill="{StaticResource AppMenuIconAccentBrush}" Data="M11.7,1.4 L14.6,4.3 L5.5,13.4 L2.5,13.9 L3,10.9 Z" />
|
||||||
|
<Path Fill="#FFEAF3FB" Data="M10.7,2.4 L13.6,5.3 L12.8,6.1 L9.9,3.2 Z" />
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="Удалить"
|
||||||
|
Command="{Binding DeleteCommand}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Viewbox Width="14" Height="14">
|
||||||
|
<Canvas Width="16" Height="16">
|
||||||
|
<Rectangle Canvas.Left="4" Canvas.Top="5" Width="8" Height="8" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="3" Canvas.Top="3" Width="10" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="1.5" Width="4" Height="2" RadiusX="1" RadiusY="1" Fill="{StaticResource AppMenuIconDangerBrush}" />
|
||||||
|
<Rectangle Canvas.Left="6" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
<Rectangle Canvas.Left="9" Canvas.Top="6.5" Width="1" Height="5" Fill="White" />
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<EventSetter Event="PreviewMouseRightButtonDown"
|
||||||
|
Handler="DataGridRow_PreviewMouseRightButtonDown" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="ID"
|
<DataGridTextColumn Header="ID"
|
||||||
Width="90"
|
Width="90"
|
||||||
@@ -66,18 +113,6 @@
|
|||||||
Margin="0,12,0,0"
|
Margin="0,12,0,0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right">
|
HorizontalAlignment="Right">
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding AddCommand}"
|
|
||||||
Content="Добавить" />
|
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding EditCommand}"
|
|
||||||
Content="Изменить" />
|
|
||||||
<Button Width="110"
|
|
||||||
Margin="0,0,8,0"
|
|
||||||
Command="{Binding DeleteCommand}"
|
|
||||||
Content="Удалить" />
|
|
||||||
<Button Width="90"
|
<Button Width="90"
|
||||||
IsCancel="True"
|
IsCancel="True"
|
||||||
Content="Закрыть" />
|
Content="Закрыть" />
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace XLAB2
|
namespace XLAB2
|
||||||
{
|
{
|
||||||
@@ -13,6 +15,16 @@ namespace XLAB2
|
|||||||
DataContext = _viewModel;
|
DataContext = _viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataGridRow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var row = sender as DataGridRow;
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
row.IsSelected = true;
|
||||||
|
row.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
await _viewModel.InitializeAsync();
|
await _viewModel.InitializeAsync();
|
||||||
|
|||||||
Reference in New Issue
Block a user