Skip to content

Commit 649888c

Browse files
Updated the sample version
1 parent 7be7f97 commit 649888c

File tree

5 files changed

+58
-47
lines changed

5 files changed

+58
-47
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
This example demonstrates how to show the SQLite database data to Chart. Please refer KB link for more details,
44

5-
KB article - [How to bind the SQLite Database to the WinUI Chart (SfCartesianChart)](https://www.syncfusion.com/kb/13689/how-to-bind-the-sqlite-database-to-the-winui-chart-sfcartesianchart)
5+
## Troubleshooting
6+
7+
#### Path too long exception
8+
9+
If you are facing a path too long exception when building this example project, close Visual Studio and rename the repository to a shorter name before building the project.
10+
11+
For more details, refer to the KB on [How to create custom legend items in WPF Chart?](https://www.syncfusion.com/kb/13689/how-to-bind-the-sqlite-database-to-the-winui-chart-sfcartesianchart).
612

713
Follow these steps to learn how to work with the WinUI Chart using the SQLite database.
814

WinUI_ChartSqliteSample/App.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Application
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application
23
x:Class="WinUI_ChartSqliteSample.App"
34
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
45
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

WinUI_ChartSqliteSample/App.xaml.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
using Microsoft.UI.Xaml;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Microsoft.UI.Xaml;
27
using Microsoft.UI.Xaml.Controls;
38
using Microsoft.UI.Xaml.Controls.Primitives;
49
using Microsoft.UI.Xaml.Data;
510
using Microsoft.UI.Xaml.Input;
611
using Microsoft.UI.Xaml.Media;
712
using Microsoft.UI.Xaml.Navigation;
8-
using System;
9-
using System.IO;
10-
13+
using Windows.ApplicationModel;
14+
using Windows.ApplicationModel.Activation;
15+
using Windows.Foundation;
16+
using Windows.Foundation.Collections;
1117

1218
// To learn more about WinUI, the WinUI project structure,
1319
// and more about our project templates, see: http://aka.ms/winui-project-info.
@@ -19,9 +25,10 @@ namespace WinUI_ChartSqliteSample
1925
/// </summary>
2026
public partial class App : Application
2127
{
28+
2229
static ChartDatabase database;
2330

24-
private Window m_window;
31+
2532

2633
public static ChartDatabase Database
2734
{
@@ -35,6 +42,7 @@ public static ChartDatabase Database
3542
}
3643
}
3744

45+
3846
/// <summary>
3947
/// Initializes the singleton application object. This is the first line of authored code
4048
/// executed, and as such is the logical equivalent of main() or WinMain().
@@ -45,8 +53,7 @@ public App()
4553
}
4654

4755
/// <summary>
48-
/// Invoked when the application is launched normally by the end user. Other entry points
49-
/// will be used such as when the application is launched to open a specific file.
56+
/// Invoked when the application is launched.
5057
/// </summary>
5158
/// <param name="args">Details about the launch request and process.</param>
5259
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
@@ -57,5 +64,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
5764
m_window.Activate();
5865
rootFrame.Navigate(typeof(MainPage));
5966
}
67+
68+
private Window? m_window;
6069
}
6170
}
Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
4-
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
4+
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
55
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
66
<RootNamespace>WinUI_ChartSqliteSample</RootNamespace>
77
<ApplicationManifest>app.manifest</ApplicationManifest>
8-
<Platforms>x86;x64;arm64</Platforms>
9-
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
10-
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
8+
<Platforms>x86;x64;ARM64</Platforms>
9+
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
10+
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
1111
<UseWinUI>true</UseWinUI>
1212
<EnableMsixTooling>true</EnableMsixTooling>
13+
<Nullable>enable</Nullable>
1314
</PropertyGroup>
14-
<ItemGroup>
15-
<None Remove="AddChartDataPage.xaml" />
16-
<None Remove="ChartSample.xaml" />
17-
<None Remove="MainPage.xaml" />
18-
</ItemGroup>
1915

2016
<ItemGroup>
2117
<Content Include="Assets\SplashScreen.scale-200.png" />
@@ -28,14 +24,10 @@
2824
</ItemGroup>
2925

3026
<ItemGroup>
31-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
32-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.194" />
33-
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
34-
<PackageReference Include="Syncfusion.Chart.WinUI" Version="*" />
3527
<Manifest Include="$(ApplicationManifest)" />
3628
</ItemGroup>
3729

38-
<!--
30+
<!--
3931
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
4032
Tools extension to be activated for this project even if the Windows App SDK Nuget
4133
package has not yet been restored.
@@ -44,27 +36,26 @@
4436
<ProjectCapability Include="Msix" />
4537
</ItemGroup>
4638
<ItemGroup>
47-
<Page Update="MainPage.xaml">
48-
<Generator>MSBuild:Compile</Generator>
49-
</Page>
50-
</ItemGroup>
51-
<ItemGroup>
52-
<Page Update="ChartSample.xaml">
53-
<Generator>MSBuild:Compile</Generator>
54-
</Page>
55-
</ItemGroup>
56-
<ItemGroup>
57-
<Page Update="AddChartDataPage.xaml">
58-
<Generator>MSBuild:Compile</Generator>
59-
</Page>
39+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.3916" />
40+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250401001" />
41+
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
42+
<PackageReference Include="Syncfusion.Chart.WinUI" Version="*" />
6043
</ItemGroup>
6144

62-
<!--
63-
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
64-
Explorer "Package and Publish" context menu entry to be enabled for this project even if
45+
<!--
46+
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
47+
Explorer "Package and Publish" context menu entry to be enabled for this project even if
6548
the Windows App SDK Nuget package has not yet been restored.
6649
-->
6750
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
6851
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
6952
</PropertyGroup>
70-
</Project>
53+
54+
<!-- Publish Properties -->
55+
<PropertyGroup>
56+
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
57+
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
58+
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
59+
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
60+
</PropertyGroup>
61+
</Project>

WinUI_ChartSqliteSample/app.manifest

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
33
<assemblyIdentity version="1.0.0.0" name="WinUI_ChartSqliteSample.app"/>
44

5+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
6+
<application>
7+
<!-- The ID below informs the system that this application is compatible with OS features first introduced in Windows 10.
8+
It is necessary to support features in unpackaged applications, for example the custom titlebar implementation.
9+
For more info see https://docs.microsoft.com/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#declare-os-compatibility-in-your-application-manifest -->
10+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
11+
</application>
12+
</compatibility>
13+
514
<application xmlns="urn:schemas-microsoft-com:asm.v3">
615
<windowsSettings>
7-
<!-- The combination of below two tags have the following effect:
8-
1) Per-Monitor for >= Windows 10 Anniversary Update
9-
2) System < Windows 10 Anniversary Update
10-
-->
11-
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
12-
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
16+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
1317
</windowsSettings>
1418
</application>
15-
</assembly>
19+
</assembly>

0 commit comments

Comments
 (0)