Skip to content

Commit 4a64b70

Browse files
993580 - Added sample
1 parent 3a20317 commit 4a64b70

File tree

13 files changed

+653
-0
lines changed

13 files changed

+653
-0
lines changed

ContextMenu/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
5+
</startup>
6+
</configuration>

ContextMenu/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="ContextMenu.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:ContextMenu"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

ContextMenu/App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace ContextMenu
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

ContextMenu/ContextMenu.csproj

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{85F1D866-8D0B-432D-B3E8-97D80AD1D292}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>ContextMenu</RootNamespace>
10+
<AssemblyName>ContextMenu</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
<TargetFrameworkProfile />
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<PlatformTarget>AnyCPU</PlatformTarget>
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<PlatformTarget>AnyCPU</PlatformTarget>
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
40+
<HintPath>packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Syncfusion.Licensing"/>
43+
<Reference Include="Syncfusion.Shared.WPF"/>
44+
<Reference Include="Syncfusion.Tools.WPF"/>
45+
<Reference Include="System" />
46+
<Reference Include="System.Data" />
47+
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48+
<HintPath>packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll</HintPath>
49+
</Reference>
50+
<Reference Include="System.Xml" />
51+
<Reference Include="Microsoft.CSharp" />
52+
<Reference Include="System.Core" />
53+
<Reference Include="System.Xml.Linq" />
54+
<Reference Include="System.Data.DataSetExtensions" />
55+
<Reference Include="System.Net.Http" />
56+
<Reference Include="System.Xaml">
57+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
58+
</Reference>
59+
<Reference Include="WindowsBase" />
60+
<Reference Include="PresentationCore" />
61+
<Reference Include="PresentationFramework" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<ApplicationDefinition Include="App.xaml">
65+
<Generator>MSBuild:Compile</Generator>
66+
<SubType>Designer</SubType>
67+
</ApplicationDefinition>
68+
<Compile Include="ViewModel\ViewModel.cs" />
69+
<Page Include="MainWindow.xaml">
70+
<Generator>MSBuild:Compile</Generator>
71+
<SubType>Designer</SubType>
72+
</Page>
73+
<Compile Include="App.xaml.cs">
74+
<DependentUpon>App.xaml</DependentUpon>
75+
<SubType>Code</SubType>
76+
</Compile>
77+
<Compile Include="MainWindow.xaml.cs">
78+
<DependentUpon>MainWindow.xaml</DependentUpon>
79+
<SubType>Code</SubType>
80+
</Compile>
81+
</ItemGroup>
82+
<ItemGroup>
83+
<Compile Include="Properties\AssemblyInfo.cs">
84+
<SubType>Code</SubType>
85+
</Compile>
86+
<Compile Include="Properties\Resources.Designer.cs">
87+
<AutoGen>True</AutoGen>
88+
<DesignTime>True</DesignTime>
89+
<DependentUpon>Resources.resx</DependentUpon>
90+
</Compile>
91+
<Compile Include="Properties\Settings.Designer.cs">
92+
<AutoGen>True</AutoGen>
93+
<DependentUpon>Settings.settings</DependentUpon>
94+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
95+
</Compile>
96+
<EmbeddedResource Include="Properties\Resources.resx">
97+
<Generator>ResXFileCodeGenerator</Generator>
98+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
99+
</EmbeddedResource>
100+
<None Include="Properties\Settings.settings">
101+
<Generator>SettingsSingleFileGenerator</Generator>
102+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
103+
</None>
104+
</ItemGroup>
105+
<ItemGroup>
106+
<None Include="App.config" />
107+
</ItemGroup>
108+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
109+
</Project>

ContextMenu/ContextMenu.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29911.84
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContextMenu", "ContextMenu.csproj", "{85F1D866-8D0B-432D-B3E8-97D80AD1D292}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{85F1D866-8D0B-432D-B3E8-97D80AD1D292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{85F1D866-8D0B-432D-B3E8-97D80AD1D292}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{85F1D866-8D0B-432D-B3E8-97D80AD1D292}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{85F1D866-8D0B-432D-B3E8-97D80AD1D292}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {C9EA5AC1-69CA-43E5-B39D-7BFA485684D7}
24+
EndGlobalSection
25+
EndGlobal

ContextMenu/MainWindow.xaml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<Window x:Class="ContextMenu.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
7+
xmlns:local="clr-namespace:ContextMenu"
8+
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
9+
Title="TabControl - ContextMenu" Height="450" Width="800">
10+
<Window.DataContext>
11+
<local:ViewModel/>
12+
</Window.DataContext>
13+
14+
<Grid>
15+
<Grid.ColumnDefinitions>
16+
<ColumnDefinition Width="*"/>
17+
<ColumnDefinition Width="*"/>
18+
</Grid.ColumnDefinitions>
19+
20+
<Border Grid.Column="0">
21+
<Grid>
22+
<syncfusion:TabControlExt ShowTabItemContextMenu="{Binding ShowTabItemContextMenu}"
23+
ShowTabListContextMenu="{Binding ShowTabListContextMenu}"
24+
IsCustomTabItemContextMenuEnabled="{Binding IsCustomTabItemContextMenuEnabled}"
25+
DefaultContextMenuItemVisibility="{Binding DefaultContextMenuItemVisibility}"
26+
Name="tabControlExt"
27+
Margin="20">
28+
<syncfusion:TabItemExt Header="tabItem1">
29+
<syncfusion:TabItemExt.Content>
30+
<TextBlock HorizontalAlignment="Center"
31+
VerticalAlignment="Center"
32+
Text="This is the first tab item content"/>
33+
</syncfusion:TabItemExt.Content>
34+
35+
<!--Adding custom context menu items-->
36+
<syncfusion:TabItemExt.ContextMenuItems>
37+
<syncfusion:CustomMenuItem Header="Edit">
38+
<!--Adding sub custom context menu items-->
39+
<syncfusion:CustomMenuItem Header="SubItem0"/>
40+
<syncfusion:CustomMenuItem Header="SubItem1"/>
41+
<syncfusion:CustomMenuItem Header="SubItem2">
42+
<syncfusion:CustomMenuItem Header="Level 2"/>
43+
</syncfusion:CustomMenuItem>
44+
</syncfusion:CustomMenuItem>
45+
<syncfusion:CustomMenuItem Header="Copy" />
46+
<syncfusion:CustomMenuItem Header="Paste" />
47+
</syncfusion:TabItemExt.ContextMenuItems>
48+
</syncfusion:TabItemExt>
49+
<syncfusion:TabItemExt Header="tabItem2">
50+
<syncfusion:TabItemExt.Content>
51+
<TextBlock HorizontalAlignment="Center"
52+
VerticalAlignment="Center"
53+
Text="This is the second tab item content"/>
54+
</syncfusion:TabItemExt.Content>
55+
56+
<!--Adding custom context menu items-->
57+
<syncfusion:TabItemExt.ContextMenuItems>
58+
<syncfusion:CustomMenuItem Header="Edit">
59+
<!--Adding sub custom context menu items-->
60+
<syncfusion:CustomMenuItem Header="SubItem0"/>
61+
<syncfusion:CustomMenuItem Header="SubItem1"/>
62+
<syncfusion:CustomMenuItem Header="SubItem2">
63+
<syncfusion:CustomMenuItem Header="Level 2"/>
64+
</syncfusion:CustomMenuItem>
65+
</syncfusion:CustomMenuItem>
66+
<syncfusion:CustomMenuItem Header="Copy" />
67+
<syncfusion:CustomMenuItem Header="Paste" />
68+
</syncfusion:TabItemExt.ContextMenuItems>
69+
</syncfusion:TabItemExt>
70+
</syncfusion:TabControlExt>
71+
</Grid>
72+
</Border>
73+
74+
<GroupBox Margin="0,0,3,3"
75+
Grid.Column="1"
76+
Header="User Options">
77+
<Grid HorizontalAlignment="Stretch"
78+
VerticalAlignment="Stretch"
79+
Margin="5">
80+
<Grid.RowDefinitions>
81+
<RowDefinition Height="Auto"></RowDefinition>
82+
<RowDefinition Height="Auto"></RowDefinition>
83+
<RowDefinition Height="Auto"></RowDefinition>
84+
<RowDefinition Height="Auto"></RowDefinition>
85+
</Grid.RowDefinitions>
86+
<Grid.ColumnDefinitions>
87+
<ColumnDefinition Width="220"></ColumnDefinition>
88+
<ColumnDefinition Width="150" ></ColumnDefinition>
89+
</Grid.ColumnDefinitions>
90+
91+
<TextBlock Margin="3"
92+
Text ="Show TabItem ContextMenu"
93+
Grid.Row="0"
94+
Grid.Column="0"/>
95+
<CheckBox IsChecked="{Binding ShowTabItemContextMenu, Mode=TwoWay}"
96+
Grid.Row="0"
97+
Grid.Column="1"
98+
Margin="3"/>
99+
100+
<TextBlock Margin="3"
101+
Text ="Show Custom TabItem ContextMenu"
102+
Grid.Row="1"
103+
Grid.Column="0"/>
104+
<CheckBox IsChecked="{Binding IsCustomTabItemContextMenuEnabled, Mode=TwoWay}"
105+
Grid.Row="1"
106+
Grid.Column="1"
107+
Margin="3"/>
108+
109+
<TextBlock Margin="3"
110+
Text ="Default ContextMenuItem Visibility"
111+
Grid.Row="2"
112+
Grid.Column="0"/>
113+
<ComboBox SelectedItem="{Binding DefaultContextMenuItemVisibility, Mode=TwoWay}"
114+
Grid.Row="2"
115+
Grid.Column="1"
116+
Margin="3">
117+
<Visibility>Visible</Visibility>
118+
<Visibility>Collapsed</Visibility>
119+
</ComboBox>
120+
121+
<TextBlock Margin="3"
122+
Text ="Show TabList ContextMenu"
123+
Grid.Row="3"
124+
Grid.Column="0"/>
125+
<CheckBox IsChecked="{Binding ShowTabListContextMenu, Mode=TwoWay}"
126+
Grid.Row="3"
127+
Grid.Column="1"
128+
Margin="3"/>
129+
130+
</Grid>
131+
</GroupBox>
132+
</Grid>
133+
</Window>
134+

ContextMenu/MainWindow.xaml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace ContextMenu
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindow : Window
22+
{
23+
public MainWindow()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[assembly: AssemblyTitle("ContextMenu")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("ContextMenu")]
15+
[assembly: AssemblyCopyright("Copyright © 2020")]
16+
[assembly: AssemblyTrademark("")]
17+
[assembly: AssemblyCulture("")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
//In order to begin building localizable applications, set
25+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
26+
//inside a <PropertyGroup>. For example, if you are using US english
27+
//in your source files, set the <UICulture> to en-US. Then uncomment
28+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
29+
//the line below to match the UICulture setting in the project file.
30+
31+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32+
33+
34+
[assembly: ThemeInfo(
35+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36+
//(used if a resource is not found in the page,
37+
// or application resource dictionaries)
38+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39+
//(used if a resource is not found in the page,
40+
// app, or any theme specific resource dictionaries)
41+
)]
42+
43+
44+
// Version information for an assembly consists of the following four values:
45+
//
46+
// Major Version
47+
// Minor Version
48+
// Build Number
49+
// Revision
50+
//
51+
// You can specify all the values or you can default the Build and Revision Numbers
52+
// by using the '*' as shown below:
53+
// [assembly: AssemblyVersion("1.0.*")]
54+
[assembly: AssemblyVersion("1.0.0.0")]
55+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)