Skip to content

Commit 883f248

Browse files
Merge pull request #1 from Naveen-chawla/master
WPF-45710 : How to load Spreadsheet control inside the StackPanel?
2 parents bbbe670 + 44467bc commit 883f248

14 files changed

+550
-0
lines changed

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.1" />
5+
</startup>
6+
</configuration>

App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="LoadSpreadsheetControl_InsideStackPanel.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:LoadSpreadsheetControl_InsideStackPanel"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

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 LoadSpreadsheetControl_InsideStackPanel
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

Data/sample excel file.xlsx

11.2 KB
Binary file not shown.
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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>{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>LoadSpreadsheetControl_InsideStackPanel</RootNamespace>
10+
<AssemblyName>LoadSpreadsheetControl_InsideStackPanel</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</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+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="Syncfusion.Compression.Base, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
39+
<HintPath>..\packages\Syncfusion.Compression.Base.17.4.0.53\lib\net46\Syncfusion.Compression.Base.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Syncfusion.ExcelChartToImageConverter.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
42+
<HintPath>..\packages\Syncfusion.ExcelChartToImageConverter.WPF.17.4.0.53\lib\net46\Syncfusion.ExcelChartToImageConverter.WPF.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Syncfusion.Licensing, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
45+
<HintPath>..\packages\Syncfusion.Licensing.17.4.0.53\lib\net46\Syncfusion.Licensing.dll</HintPath>
46+
</Reference>
47+
<Reference Include="Syncfusion.SfCellGrid.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
48+
<HintPath>..\packages\Syncfusion.SfCellGrid.WPF.17.4.0.53\lib\net46\Syncfusion.SfCellGrid.WPF.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Syncfusion.SfChart.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
51+
<HintPath>..\packages\Syncfusion.SfChart.WPF.17.4.0.53\lib\net46\Syncfusion.SfChart.WPF.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Syncfusion.SfGridCommon.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
54+
<HintPath>..\packages\Syncfusion.SfGridCommon.WPF.17.4.0.53\lib\net46\Syncfusion.SfGridCommon.WPF.dll</HintPath>
55+
</Reference>
56+
<Reference Include="Syncfusion.SfSpreadsheet.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
57+
<HintPath>..\packages\Syncfusion.SfSpreadsheet.WPF.17.4.0.53\lib\net46\Syncfusion.SfSpreadsheet.WPF.dll</HintPath>
58+
</Reference>
59+
<Reference Include="Syncfusion.SfSpreadsheetHelper.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
60+
<HintPath>..\packages\Syncfusion.SfSpreadsheetHelper.WPF.17.4.0.53\lib\net46\Syncfusion.SfSpreadsheetHelper.WPF.dll</HintPath>
61+
</Reference>
62+
<Reference Include="Syncfusion.Shared.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
63+
<HintPath>..\packages\Syncfusion.Shared.WPF.17.4.0.53\lib\net46\Syncfusion.Shared.WPF.dll</HintPath>
64+
</Reference>
65+
<Reference Include="Syncfusion.Tools.WPF, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
66+
<HintPath>..\packages\Syncfusion.Tools.WPF.17.4.0.53\lib\net46\Syncfusion.Tools.WPF.dll</HintPath>
67+
</Reference>
68+
<Reference Include="Syncfusion.XlsIO.Base, Version=17.4460.0.53, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
69+
<HintPath>..\packages\Syncfusion.XlsIO.Wpf.17.4.0.53\lib\net46\Syncfusion.XlsIO.Base.dll</HintPath>
70+
</Reference>
71+
<Reference Include="System" />
72+
<Reference Include="System.Data" />
73+
<Reference Include="System.Xml" />
74+
<Reference Include="Microsoft.CSharp" />
75+
<Reference Include="System.Core" />
76+
<Reference Include="System.Xml.Linq" />
77+
<Reference Include="System.Data.DataSetExtensions" />
78+
<Reference Include="System.Net.Http" />
79+
<Reference Include="System.Xaml">
80+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
81+
</Reference>
82+
<Reference Include="WindowsBase" />
83+
<Reference Include="PresentationCore" />
84+
<Reference Include="PresentationFramework" />
85+
</ItemGroup>
86+
<ItemGroup>
87+
<ApplicationDefinition Include="App.xaml">
88+
<Generator>MSBuild:Compile</Generator>
89+
<SubType>Designer</SubType>
90+
</ApplicationDefinition>
91+
<Page Include="MainWindow.xaml">
92+
<Generator>MSBuild:Compile</Generator>
93+
<SubType>Designer</SubType>
94+
</Page>
95+
<Compile Include="App.xaml.cs">
96+
<DependentUpon>App.xaml</DependentUpon>
97+
<SubType>Code</SubType>
98+
</Compile>
99+
<Compile Include="MainWindow.xaml.cs">
100+
<DependentUpon>MainWindow.xaml</DependentUpon>
101+
<SubType>Code</SubType>
102+
</Compile>
103+
</ItemGroup>
104+
<ItemGroup>
105+
<Compile Include="Properties\AssemblyInfo.cs">
106+
<SubType>Code</SubType>
107+
</Compile>
108+
<Compile Include="Properties\Resources.Designer.cs">
109+
<AutoGen>True</AutoGen>
110+
<DesignTime>True</DesignTime>
111+
<DependentUpon>Resources.resx</DependentUpon>
112+
</Compile>
113+
<Compile Include="Properties\Settings.Designer.cs">
114+
<AutoGen>True</AutoGen>
115+
<DependentUpon>Settings.settings</DependentUpon>
116+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
117+
</Compile>
118+
<EmbeddedResource Include="Properties\Resources.resx">
119+
<Generator>ResXFileCodeGenerator</Generator>
120+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
121+
</EmbeddedResource>
122+
<None Include="packages.config" />
123+
<None Include="Properties\Settings.settings">
124+
<Generator>SettingsSingleFileGenerator</Generator>
125+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
126+
</None>
127+
</ItemGroup>
128+
<ItemGroup>
129+
<None Include="App.config" />
130+
</ItemGroup>
131+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
132+
</Project>
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 15
4+
VisualStudioVersion = 15.0.28307.902
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadSpreadsheetControl_InsideStackPanel", "LoadSpreadsheetControl_InsideStackPanel.csproj", "{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}"
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+
{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2E1BAFEA-DF32-4C32-AF85-34ED480CA4FA}.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 = {1B69D687-99A1-4333-A841-9E144E1D0052}
24+
EndGlobalSection
25+
EndGlobal

MainWindow.xaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<syncfusion:RibbonWindow x:Class="LoadSpreadsheetControl_InsideStackPanel.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:local="clr-namespace:LoadSpreadsheetControl_InsideStackPanel"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="650" Width="800">
10+
11+
<StackPanel>
12+
<Grid Height="750" Width="1000">
13+
<Grid.RowDefinitions>
14+
<RowDefinition Height="70"/>
15+
<RowDefinition Height="auto"/>
16+
<RowDefinition Height="*"/>
17+
</Grid.RowDefinitions>
18+
<Button Content="Load" Grid.Row="0" VerticalAlignment="Top" Width="100" Click="Button_Click" HorizontalAlignment="Left" Margin="10"/>
19+
<syncfusion:SfSpreadsheetRibbon Grid.Row="1" syncfusion:SkinStorage.VisualStyle="office2010lBlue"/>
20+
<syncfusion:SfSpreadsheet Name="spreadsheet" Grid.Row="2" Visibility="Hidden"/>
21+
</Grid>
22+
</StackPanel>
23+
</syncfusion:RibbonWindow>

MainWindow.xaml.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using Syncfusion.UI.Xaml.Spreadsheet.Helpers;
2+
using Syncfusion.Windows.Tools.Controls;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using System.Windows;
9+
using System.Windows.Controls;
10+
using System.Windows.Data;
11+
using System.Windows.Documents;
12+
using System.Windows.Input;
13+
using System.Windows.Media;
14+
using System.Windows.Media.Imaging;
15+
using System.Windows.Navigation;
16+
using System.Windows.Shapes;
17+
18+
namespace LoadSpreadsheetControl_InsideStackPanel
19+
{
20+
/// <summary>
21+
/// Interaction logic for MainWindow.xaml
22+
/// </summary>
23+
public partial class MainWindow : RibbonWindow
24+
{
25+
public MainWindow()
26+
{
27+
InitializeComponent();
28+
29+
}
30+
31+
private void Button_Click(object sender, RoutedEventArgs e)
32+
{
33+
//sample excel file
34+
spreadsheet.Open("..\\..\\Data\\sample excel file.xlsx");
35+
//Event Subscription
36+
spreadsheet.WorkbookLoaded += Spreadsheet_WorkbookLoaded;
37+
}
38+
//Event Customization
39+
private void Spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)
40+
{
41+
spreadsheet.Visibility = Visibility.Visible;
42+
}
43+
}
44+
}

Properties/AssemblyInfo.cs

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("LoadSpreadsheetControl_InsideStackPanel")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("LoadSpreadsheetControl_InsideStackPanel")]
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")]

Properties/Resources.Designer.cs

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

0 commit comments

Comments
 (0)