-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
53 lines (53 loc) · 3.79 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<Window x:Class="UndoOperation.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:UndoOperation"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<dxb:ToolBarControl>
<dxb:BarButtonItem Content="Refresh (F5)" Command="{Binding View.Commands.RefreshDataSource, ElementName=grid}" Glyph="{dx:DXImage SvgImages/Icon Builder/Actions_Refresh.svg}" BarItemDisplayMode="ContentAndGlyph" />
<dxb:BarButtonItem Content="Edit (F2)" Command="{Binding View.Commands.EditFocusedRow, ElementName=grid}" Glyph="{dx:DXImage SvgImages/Icon Builder/Actions_Edit.svg}" BarItemDisplayMode="ContentAndGlyph" />
<dxb:BarButtonItem Content="New" Command="{Binding View.Commands.AddNewRow, ElementName=grid}" Glyph="{dx:DXImage SvgImages/Icon Builder/Actions_Add.svg}" BarItemDisplayMode="ContentAndGlyph" />
<dxb:BarButtonItem Content="Delete (Del)" Command="{Binding View.Commands.DeleteFocusedRow, ElementName=grid}" Glyph="{dx:DXImage SvgImages/Icon Builder/Actions_Delete.svg}" BarItemDisplayMode="ContentAndGlyph" />
<dxb:BarButtonItem Content="Undo (Ctrl+Z)" Command="{Binding UndoCommand, ElementName=undoBehavior}" Glyph="{dx:DXImage SvgImages/Icon Builder/Actions_Undo.svg}" BarItemDisplayMode="ContentAndGlyph" />
</dxb:ToolBarControl>
<dxg:GridControl x:Name="grid" ItemsSource="{Binding ItemsSource}" RestoreStateKeyFieldName="Id" RestoreStateOnSourceChange="True" Grid.Row="1">
<dxg:GridControl.View>
<dxg:TableView NewItemRowPosition="Top"
ShowUpdateRowButtons="OnCellEditorOpen"
ValidateRowCommand="{Binding ValidateRowCommand}"
ValidateRowDeletionCommand="{Binding ValidateRowDeletionCommand}"
DataSourceRefreshCommand="{Binding DataSourceRefreshCommand}"
ShowFixedTotalSummary="True">
<dxmvvm:Interaction.Behaviors>
<local:UndoCRUDOperationsBehavior x:Name="undoBehavior" CopyOperationsSupporter="{Binding CopyOperationsSupporter}" />
</dxmvvm:Interaction.Behaviors>
</dxg:TableView>
</dxg:GridControl.View>
<dxg:GridColumn FieldName="Id" IsSmart="True" ReadOnly="True" />
<dxg:GridColumn FieldName="FirstName" IsSmart="True" />
<dxg:GridColumn FieldName="LastName" IsSmart="True" />
<dxg:GridControl.InputBindings>
<KeyBinding Command="{Binding View.Commands.DeleteFocusedRow, ElementName=grid}" Key="Delete" />
<KeyBinding Command="{Binding UndoCommand, ElementName=undoBehavior}" Key="Z" Modifiers="Ctrl" />
</dxg:GridControl.InputBindings>
<dxg:GridControl.TotalSummary>
<dxg:GridSummaryItem SummaryType="Count" Alignment="Right" />
</dxg:GridControl.TotalSummary>
</dxg:GridControl>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
</Grid>
<Window.DataContext>
<local:MainViewModel />
</Window.DataContext>
</Window>