Skip to content

Commit f73b0ef

Browse files
committed
Added examples for .NET MAUI PDF Viewer
1 parent ed8ca16 commit f73b0ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1866
-3
lines changed

Custom Toolbar/App.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:CustomToolbar"
5+
x:Class="CustomToolbar.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>

Custom Toolbar/App.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace CustomToolbar;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
MainPage = new MainPage();
9+
}
10+
}
846 KB
Binary file not shown.

Custom Toolbar/CustomToolbar.csproj

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>CustomToolbar</RootNamespace>
10+
<UseMaui>true</UseMaui>
11+
<SingleProject>true</SingleProject>
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
14+
<!-- Display name -->
15+
<ApplicationTitle>CustomToolbar</ApplicationTitle>
16+
17+
<!-- App Identifier -->
18+
<ApplicationId>com.companyname.customtoolbar</ApplicationId>
19+
<ApplicationIdGuid>3aa58b58-9e47-4b7e-b07a-303167d6ce87</ApplicationIdGuid>
20+
21+
<!-- Versions -->
22+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
23+
<ApplicationVersion>1</ApplicationVersion>
24+
25+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
29+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
30+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<!-- App Icon -->
35+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
36+
37+
<!-- Splash Screen -->
38+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
39+
40+
<!-- Images -->
41+
<MauiImage Include="Resources\Images\*" />
42+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
43+
44+
<!-- Custom Fonts -->
45+
<MauiFont Include="Resources\Fonts\*" />
46+
47+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
48+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
49+
</ItemGroup>
50+
51+
<ItemGroup>
52+
<EmbeddedResource Include="Assets\PDF_Succinctly.pdf" />
53+
</ItemGroup>
54+
55+
<ItemGroup>
56+
<PackageReference Include="Syncfusion.Maui.PdfViewer" Version="20.4.38" />
57+
</ItemGroup>
58+
59+
<ItemGroup>
60+
<Compile Update="View\MainPage.xaml.cs">
61+
<DependentUpon>MainPage.xaml</DependentUpon>
62+
</Compile>
63+
</ItemGroup>
64+
65+
<ItemGroup>
66+
<MauiXaml Update="UI\MessageBox.xaml">
67+
<Generator>MSBuild:Compile</Generator>
68+
</MauiXaml>
69+
<MauiXaml Update="UI\PasswordDialogBox.xaml">
70+
<Generator>MSBuild:Compile</Generator>
71+
</MauiXaml>
72+
<MauiXaml Update="View\MainPage.xaml">
73+
<Generator>MSBuild:Compile</Generator>
74+
</MauiXaml>
75+
</ItemGroup>
76+
77+
</Project>

Custom Toolbar/CustomToolbar.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31611.283
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomToolbar", "CustomToolbar.csproj", "{A55124B0-5600-4431-B692-8A24590778B7}"
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+
{A55124B0-5600-4431-B692-8A24590778B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A55124B0-5600-4431-B692-8A24590778B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A55124B0-5600-4431-B692-8A24590778B7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{A55124B0-5600-4431-B692-8A24590778B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{A55124B0-5600-4431-B692-8A24590778B7}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{A55124B0-5600-4431-B692-8A24590778B7}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
26+
EndGlobalSection
27+
EndGlobal

Custom Toolbar/MauiProgram.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Syncfusion.Maui.Core.Hosting;
2+
3+
namespace CustomToolbar;
4+
5+
public static class MauiProgram
6+
{
7+
public static MauiApp CreateMauiApp()
8+
{
9+
var builder = MauiApp.CreateBuilder();
10+
builder
11+
.UseMauiApp<App>()
12+
.ConfigureFonts(fonts =>
13+
{
14+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
15+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
16+
});
17+
builder.ConfigureSyncfusionCore();
18+
return builder.Build();
19+
}
20+
}
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+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
</manifest>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
5+
namespace CustomToolbar;
6+
7+
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8+
public class MainActivity : MauiAppCompatActivity
9+
{
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Android.App;
2+
using Android.Runtime;
3+
4+
namespace CustomToolbar;
5+
6+
[Application]
7+
public class MainApplication : MauiApplication
8+
{
9+
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10+
: base(handle, ownership)
11+
{
12+
}
13+
14+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15+
}
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+
<resources>
3+
<color name="colorPrimary">#512BD4</color>
4+
<color name="colorPrimaryDark">#2B0B98</color>
5+
<color name="colorAccent">#2B0B98</color>
6+
</resources>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Foundation;
2+
3+
namespace CustomToolbar;
4+
5+
[Register("AppDelegate")]
6+
public class AppDelegate : MauiUIApplicationDelegate
7+
{
8+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>UIDeviceFamily</key>
6+
<array>
7+
<integer>1</integer>
8+
<integer>2</integer>
9+
</array>
10+
<key>UIRequiredDeviceCapabilities</key>
11+
<array>
12+
<string>arm64</string>
13+
</array>
14+
<key>UISupportedInterfaceOrientations</key>
15+
<array>
16+
<string>UIInterfaceOrientationPortrait</string>
17+
<string>UIInterfaceOrientationLandscapeLeft</string>
18+
<string>UIInterfaceOrientationLandscapeRight</string>
19+
</array>
20+
<key>UISupportedInterfaceOrientations~ipad</key>
21+
<array>
22+
<string>UIInterfaceOrientationPortrait</string>
23+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
24+
<string>UIInterfaceOrientationLandscapeLeft</string>
25+
<string>UIInterfaceOrientationLandscapeRight</string>
26+
</array>
27+
<key>XSAppIconAssets</key>
28+
<string>Assets.xcassets/appicon.appiconset</string>
29+
</dict>
30+
</plist>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using ObjCRuntime;
2+
using UIKit;
3+
4+
namespace CustomToolbar;
5+
6+
public class Program
7+
{
8+
// This is the main entry point of the application.
9+
static void Main(string[] args)
10+
{
11+
// if you want to use a different Application Delegate class from "AppDelegate"
12+
// you can specify it here.
13+
UIApplication.Main(args, null, typeof(AppDelegate));
14+
}
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using Microsoft.Maui;
3+
using Microsoft.Maui.Hosting;
4+
5+
namespace CustomToolbar;
6+
7+
class Program : MauiApplication
8+
{
9+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
10+
11+
static void Main(string[] args)
12+
{
13+
var app = new Program();
14+
app.Run(args);
15+
}
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
3+
<profile name="common" />
4+
<ui-application appid="maui-application-id-placeholder" exec="CustomToolbar.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
5+
<label>maui-application-title-placeholder</label>
6+
<icon>maui-appicon-placeholder</icon>
7+
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
8+
</ui-application>
9+
<shortcut-list />
10+
<privileges>
11+
<privilege>http://tizen.org/privilege/internet</privilege>
12+
</privileges>
13+
<dependencies />
14+
<provides-appdefined-privileges />
15+
</manifest>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<maui:MauiWinUIApplication
2+
x:Class="CustomToolbar.WinUI.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:maui="using:Microsoft.Maui"
6+
xmlns:local="using:CustomToolbar.WinUI">
7+
8+
</maui:MauiWinUIApplication>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.UI.Xaml;
2+
3+
// To learn more about WinUI, the WinUI project structure,
4+
// and more about our project templates, see: http://aka.ms/winui-project-info.
5+
6+
namespace CustomToolbar.WinUI;
7+
8+
/// <summary>
9+
/// Provides application-specific behavior to supplement the default Application class.
10+
/// </summary>
11+
public partial class App : MauiWinUIApplication
12+
{
13+
/// <summary>
14+
/// Initializes the singleton application object. This is the first line of authored code
15+
/// executed, and as such is the logical equivalent of main() or WinMain().
16+
/// </summary>
17+
public App()
18+
{
19+
this.InitializeComponent();
20+
}
21+
22+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
23+
}
24+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Package
3+
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
4+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
5+
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
6+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
7+
IgnorableNamespaces="uap rescap">
8+
9+
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
10+
11+
<mp:PhoneIdentity PhoneProductId="75D5F91C-9B3C-4FEF-A4CF-F5F8F84296BE" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
12+
13+
<Properties>
14+
<DisplayName>$placeholder$</DisplayName>
15+
<PublisherDisplayName>User Name</PublisherDisplayName>
16+
<Logo>$placeholder$.png</Logo>
17+
</Properties>
18+
19+
<Dependencies>
20+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
21+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
22+
</Dependencies>
23+
24+
<Resources>
25+
<Resource Language="x-generate" />
26+
</Resources>
27+
28+
<Applications>
29+
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
30+
<uap:VisualElements
31+
DisplayName="$placeholder$"
32+
Description="$placeholder$"
33+
Square150x150Logo="$placeholder$.png"
34+
Square44x44Logo="$placeholder$.png"
35+
BackgroundColor="transparent">
36+
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
37+
<uap:SplashScreen Image="$placeholder$.png" />
38+
</uap:VisualElements>
39+
</Application>
40+
</Applications>
41+
42+
<Capabilities>
43+
<rescap:Capability Name="runFullTrust" />
44+
</Capabilities>
45+
46+
</Package>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="CustomToolbar.WinUI.app"/>
4+
5+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
6+
<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>
13+
</windowsSettings>
14+
</application>
15+
</assembly>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Foundation;
2+
3+
namespace CustomToolbar;
4+
5+
[Register("AppDelegate")]
6+
public class AppDelegate : MauiUIApplicationDelegate
7+
{
8+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9+
}

0 commit comments

Comments
 (0)