Skip to content

Commit ee58c17

Browse files
author
DevExpressExampleBot
authored
Merge pull request #2 from BrianDX/18.1.3+
Updated for 18.1
2 parents d83263f + 0002ef0 commit ee58c17

19 files changed

+96
-112
lines changed

CS/WpfApplication31.sln renamed to CS/ContextMenuToShowTopN_Example.sln

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Microsoft Visual Studio Solution File, Format Version 11.00
2-
# Visual Studio 2010
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication31", "WpfApplication31\WpfApplication31.csproj", "{41174393-1902-4D1A-8928-41EA7F290E85}"
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 14
3+
VisualStudioVersion = 14.0.25420.1
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContextMenuToShowTopN_Example", "ContextMenuToShowTopN_Example\ContextMenuToShowTopN_Example.csproj", "{41174393-1902-4D1A-8928-41EA7F290E85}"
46
EndProject
57
Global
68
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Application x:Class="ContextMenuToShowTopN_Example.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml">
2+
<Application.Resources>
3+
4+
</Application.Resources>
5+
</Application>

CS/WpfApplication31/App.xaml.cs renamed to CS/ContextMenuToShowTopN_Example/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Linq;
66
using System.Windows;
77

8-
namespace WpfApplication31
8+
namespace ContextMenuToShowTopN_Example
99
{
1010
/// <summary>
1111
/// Interaction logic for App.xaml

CS/WpfApplication31/WpfApplication31.csproj renamed to CS/ContextMenuToShowTopN_Example/ContextMenuToShowTopN_Example.csproj

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -8,10 +8,11 @@
88
<ProjectGuid>{41174393-1902-4D1A-8928-41EA7F290E85}</ProjectGuid>
99
<OutputType>WinExe</OutputType>
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>WpfApplication31</RootNamespace>
12-
<AssemblyName>WpfApplication31</AssemblyName>
11+
<RootNamespace>ContextMenuToShowTopN_Example</RootNamespace>
12+
<AssemblyName>ContextMenuToShowTopN_Example</AssemblyName>
1313
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14-
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
14+
<TargetFrameworkProfile>
15+
</TargetFrameworkProfile>
1516
<FileAlignment>512</FileAlignment>
1617
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1718
<WarningLevel>4</WarningLevel>
@@ -25,6 +26,7 @@
2526
<DefineConstants>DEBUG;TRACE</DefineConstants>
2627
<ErrorReport>prompt</ErrorReport>
2728
<WarningLevel>4</WarningLevel>
29+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2830
</PropertyGroup>
2931
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
3032
<PlatformTarget>x86</PlatformTarget>
@@ -36,38 +38,28 @@
3638
<WarningLevel>4</WarningLevel>
3739
</PropertyGroup>
3840
<ItemGroup>
39-
<Reference Include="DevExpress.Pdf.v17.1.Core, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
41+
<Reference Include="DevExpress.Pdf.v18.1.Core, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
4042
<SpecificVersion>False</SpecificVersion>
4143
</Reference>
42-
<Reference Include="DevExpress.Office.v17.1.Core, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
44+
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
4345
<SpecificVersion>False</SpecificVersion>
4446
</Reference>
45-
<Reference Include="DevExpress.RichEdit.v17.1.Core, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
47+
<Reference Include="DevExpress.Data.v18.1, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
4648
<SpecificVersion>False</SpecificVersion>
4749
</Reference>
48-
<Reference Include="DevExpress.RichEdit.v17.1.Export, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
50+
<Reference Include="DevExpress.Mvvm.v18.1, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
4951
<SpecificVersion>False</SpecificVersion>
5052
</Reference>
51-
<Reference Include="DevExpress.Printing.v17.1.Core, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
53+
<Reference Include="DevExpress.Xpf.Core.v18.1, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
5254
<SpecificVersion>False</SpecificVersion>
5355
</Reference>
54-
<Reference Include="DevExpress.Data.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
56+
<Reference Include="DevExpress.Xpf.Printing.v18.1, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
5557
<SpecificVersion>False</SpecificVersion>
5658
</Reference>
57-
<Reference Include="DevExpress.Mvvm.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
59+
<Reference Include="DevExpress.Xpf.PivotGrid.v18.1, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
5860
<SpecificVersion>False</SpecificVersion>
5961
</Reference>
60-
<Reference Include="DevExpress.Xpf.CodeView.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
61-
<Reference Include="DevExpress.Xpf.Core.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
62-
<SpecificVersion>False</SpecificVersion>
63-
</Reference>
64-
<Reference Include="DevExpress.Xpf.Printing.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
65-
<SpecificVersion>False</SpecificVersion>
66-
</Reference>
67-
<Reference Include="DevExpress.Xpf.PivotGrid.v17.1, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
68-
<SpecificVersion>False</SpecificVersion>
69-
</Reference>
70-
<Reference Include="DevExpress.PivotGrid.v17.1.Core, Version=17.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
62+
<Reference Include="DevExpress.PivotGrid.v18.1.Core, Version=18.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a">
7163
<SpecificVersion>False</SpecificVersion>
7264
</Reference>
7365
<Reference Include="System" />
@@ -157,4 +149,4 @@
157149
<Target Name="AfterBuild">
158150
</Target>
159151
-->
160-
</Project>
152+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Window
2+
x:Class="ContextMenuToShowTopN_Example.MainWindow"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
6+
xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
7+
Width="750"
8+
Height="400"
9+
Title="MainWindow">
10+
11+
<Grid>
12+
<dxpg:PivotGridControl
13+
RowTreeWidth="250"
14+
Name="pivotGridControl1"
15+
PopupMenuShowing="pivotGridControl1_PopupMenuShowing">
16+
</dxpg:PivotGridControl>
17+
</Grid>
18+
19+
</Window>
Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
using ContextMenuToShowTopN_Example.nwindDataSetTableAdapters;
12
using DevExpress.Xpf.Bars;
23
using DevExpress.Xpf.PivotGrid;
3-
using DevExpress.Xpf.PivotGrid.Internal;
44
using System.Data;
55
using System.Linq;
66
using System.Windows;
7-
using WpfApplication31.nwindDataSetTableAdapters;
87

9-
namespace WpfApplication31
8+
namespace ContextMenuToShowTopN_Example
109
{
1110
/// <summary>
1211
/// Interaction logic for MainWindow.xaml
@@ -32,53 +31,48 @@ private void InitializePivot()
3231
pivotGridControl1.Fields["ProductAmount"].Area = FieldArea.DataArea;
3332
pivotGridControl1.Fields["OrderDate"].Area = FieldArea.ColumnArea;
3433
pivotGridControl1.Fields["OrderDate"].GroupInterval = FieldGroupInterval.DateYear;
35-
36-
}
37-
38-
private void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
39-
{
40-
PivotGridFieldValueMenuInfo menuInfo = pivotGridControl1.GridMenu.MenuInfo as PivotGridFieldValueMenuInfo;
41-
this.Title = menuInfo.ValueItem.DisplayText;
42-
34+
pivotGridControl1.Fields["OrderDate"].DisplayFolder = "Date";
4335
}
4436

4537
private void pivotGridControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
4638
{
4739
FieldValueElement fvElement = e.TargetElement as FieldValueElement;
48-
FieldValueItem fvItem = fvElement.Item;
49-
if (fvItem.IsLastLevelItem)
40+
if (fvElement == null) return;
41+
42+
FieldValueElementData fvElementData = fvElement.ElementData as FieldValueElementData;
43+
if (fvElementData.IsLastLevelItem)
5044
{
51-
string itemCaption = string.Format( "Top 5 Values in this {0}", fvItem.IsColumn ? "Column" : "Row");
45+
string itemCaption = string.Format( "Top 5 Values in this {0}", fvElementData.IsColumn ? "Column" : "Row");
5246
BarButtonItem item = new BarButtonItem { Content = itemCaption };
5347
item.ItemClick += item_ItemClick;
54-
item.Tag = fvItem;
48+
item.Tag = fvElementData;
5549
e.Customizations.Add(new AddBarItemAction { Item = item });
5650
}
5751
}
5852

5953
void item_ItemClick(object sender, ItemClickEventArgs e)
6054
{
61-
FieldValueItem valueItem = e.Item.Tag as FieldValueItem;
62-
valueItem.PivotGrid.BeginUpdate();
55+
FieldValueElementData elementData = e.Item.Tag as FieldValueElementData;
56+
elementData.PivotGrid.BeginUpdate();
6357

64-
var sortConditions = valueItem.PivotGrid.GetFieldsByArea(valueItem.IsColumn ? FieldArea.ColumnArea : FieldArea.RowArea).
65-
Where(f => f.AreaIndex <= valueItem.Field.AreaIndex).Select(f => new
58+
var sortConditions = elementData.PivotGrid.GetFieldsByArea(elementData.IsColumn ? FieldArea.ColumnArea : FieldArea.RowArea).
59+
Where(f => f.AreaIndex <= elementData.Field.AreaIndex).Select(f => new
6660
{
6761
Field = f,
68-
Value = valueItem.PivotGrid.GetFieldValue(f, valueItem.MaxLastLevelIndex)
62+
Value = elementData.PivotGrid.GetFieldValue(f, elementData.MaxIndex)
6963
});
7064

71-
valueItem.PivotGrid.GetFieldsByArea(valueItem.IsColumn ? FieldArea.RowArea : FieldArea.ColumnArea).ForEach(f =>
65+
elementData.PivotGrid.GetFieldsByArea(elementData.IsColumn ? FieldArea.RowArea : FieldArea.ColumnArea).ForEach(f =>
7266
{
7367
f.SortOrder = FieldSortOrder.Descending;
74-
f.SortByField = valueItem.DataField;
68+
f.SortByField = elementData.DataField;
7569
f.SortByConditions.Clear();
7670
f.SortByConditions.AddRange(sortConditions.Select(c => new SortByCondition(c.Field, c.Value)));
7771
f.TopValueCount = 5;
7872
f.TopValueShowOthers = true;
7973

8074
});
81-
valueItem.PivotGrid.EndUpdate();
75+
elementData.PivotGrid.EndUpdate();
8276
}
8377
}
8478
}

CS/WpfApplication31/Properties/AssemblyInfo.cs renamed to CS/ContextMenuToShowTopN_Example/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
// General Information about an assembly is controlled through the following
88
// set of attributes. Change these attribute values to modify the information
99
// associated with an assembly.
10-
[assembly: AssemblyTitle("WpfApplication31")]
10+
[assembly: AssemblyTitle("ContextMenuToShowTopN_Example")]
1111
[assembly: AssemblyDescription("")]
1212
[assembly: AssemblyConfiguration("")]
1313
[assembly: AssemblyCompany("")]
14-
[assembly: AssemblyProduct("WpfApplication31")]
15-
[assembly: AssemblyCopyright("Copyright © 2010")]
14+
[assembly: AssemblyProduct("ContextMenuToShowTopN_Example")]
15+
[assembly: AssemblyCopyright("Copyright © 2018")]
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]
1818

CS/WpfApplication31/Properties/Resources.Designer.cs renamed to CS/ContextMenuToShowTopN_Example/Properties/Resources.Designer.cs

Lines changed: 19 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CS/WpfApplication31/Properties/Settings.Designer.cs renamed to CS/ContextMenuToShowTopN_Example/Properties/Settings.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)