-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
98 lines (95 loc) · 4.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<dx:ThemedWindow
x:Class="HowToEditCell.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
xmlns:local="clr-namespace:HowToEditCell"
Width="800"
Height="450"
Loaded="Window_Loaded"
Title="How to Edit Cell">
<Grid>
<dxpg:PivotGridControl
x:Name="pivotGridControl1"
DataProcessingEngine="Optimized"
local:PivotGridEditHelper.OnCellEdit="pivotGridControl1_OnCellEdit"
local:PivotGridEditHelper.UseHelper="{Binding RelativeSource={RelativeSource Self}}">
<dxpg:PivotGridControl.Fields>
<dxpg:PivotGridField
x:Name="fieldSales"
Area="DataArea"
Caption="Product Sales">
<dxpg:PivotGridField.DataBinding>
<dxpg:DataSourceColumnBinding ColumnName="ExtendedPrice"/>
</dxpg:PivotGridField.DataBinding>
<dxpg:PivotGridField.CellTemplate>
<DataTemplate>
<dxe:TextEdit
x:Name="edit"
HorizontalContentAlignment="Right"
DisplayFormatString="c2"
EditMode="InplaceInactive"
EditValue="{Binding Value, Mode=OneWay}"
local:PivotGridEditHelper.LostFocusCommand="{x:Static local:PivotGridEditHelper.Enter}"
Mask="[0-9]*\.[0-9]{0,2}"
MaskType="RegEx">
<dxe:TextEdit.InputBindings>
<KeyBinding
Key="Enter"
Command="{x:Static local:PivotGridEditHelper.Enter}"
CommandParameter="{Binding ElementName=edit}" />
<MouseBinding
Command="{x:Static local:PivotGridEditHelper.StartEdit}"
CommandParameter="{Binding ElementName=edit}"
MouseAction="LeftClick" />
</dxe:TextEdit.InputBindings>
</dxe:TextEdit>
</DataTemplate>
</dxpg:PivotGridField.CellTemplate>
</dxpg:PivotGridField>
<dxpg:PivotGridField
x:Name="fieldYear"
AllowFilter="False"
Area="ColumnArea"
Caption="Year">
<dxpg:PivotGridField.DataBinding>
<dxpg:DataSourceColumnBinding ColumnName="OrderDate" GroupInterval="DateYear"/>
</dxpg:PivotGridField.DataBinding>
</dxpg:PivotGridField>
<dxpg:PivotGridField
x:Name="fieldCategoryName"
Area="RowArea"
AreaIndex="0"
Caption="Category">
<dxpg:PivotGridField.DataBinding>
<dxpg:DataSourceColumnBinding ColumnName="CategoryName"/>
</dxpg:PivotGridField.DataBinding>
</dxpg:PivotGridField>
<dxpg:PivotGridField
x:Name="fieldProductName"
Area="RowArea"
AreaIndex="1"
Caption="Product">
<dxpg:PivotGridField.DataBinding>
<dxpg:DataSourceColumnBinding ColumnName="ProductName"/>
</dxpg:PivotGridField.DataBinding>
</dxpg:PivotGridField>
<dxpg:PivotGridField
Area="DataArea"
Caption="Percent Of Column"
CellFormat="p"
Name="fieldExtendedPrice2">
<dxpg:PivotGridField.DataBinding>
<dxpg:PercentOfTotalBinding PartitioningCriteria="ColumnValue">
<dxpg:PercentOfTotalBinding.Source>
<dxpg:DataSourceColumnBinding ColumnName="ExtendedPrice"/>
</dxpg:PercentOfTotalBinding.Source>
</dxpg:PercentOfTotalBinding>
</dxpg:PivotGridField.DataBinding>
</dxpg:PivotGridField>
</dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>
</Grid>
</dx:ThemedWindow>