Skip to content

Commit 2f460e2

Browse files
added new sample
1 parent bd6c8fd commit 2f460e2

35 files changed

Lines changed: 1046 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="MarkdownViewerGettingStarted/MarkdownViewerGettingStarted.csproj" />
3+
</Solution>
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:MarkdownViewerGettingStarted"
5+
x:Class="MarkdownViewerGettingStarted.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>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
3+
namespace MarkdownViewerGettingStarted
4+
{
5+
public partial class App : Application
6+
{
7+
public App()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
protected override Window CreateWindow(IActivationState? activationState)
13+
{
14+
return new Window(new AppShell());
15+
}
16+
}
17+
}
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+
<Shell
3+
x:Class="MarkdownViewerGettingStarted.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:MarkdownViewerGettingStarted"
7+
Title="MarkdownViewerGettingStarted">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace MarkdownViewerGettingStarted
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:markdown="clr-namespace:Syncfusion.Maui.MarkdownViewer;assembly=Syncfusion.Maui.MarkdownViewer"
5+
x:Class="MarkdownViewerGettingStarted.MainPage">
6+
7+
<markdown:SfMarkdownViewer>
8+
<markdown:SfMarkdownViewer.Source>
9+
<x:String>
10+
<![CDATA[
11+
# What is the Markdown Viewer?
12+
The Markdown Viewer is a UI control in .NET MAUI that allows developers to render Markdown content with full formatting support. It was designed to work efficiently on both mobile and desktop platforms. The viewer supports headings, bold and italic text, lists, tables, images, code blocks and more.
13+
14+
# Header 1
15+
Used for the main title or top-level heading in a Markdown document.
16+
17+
## Header 2
18+
Used to define major sections within your Markdown content.
19+
20+
### Table
21+
22+
| | Column 1 | Column 2 | Column 3 |
23+
|--------------|----------|----------|----------|
24+
| Row 1 | Content | Content | Content |
25+
| Row 2 | Content | Content | Content |
26+
| Row 3 | Content | Content | Content |
27+
]]>
28+
</x:String>
29+
</markdown:SfMarkdownViewer.Source>
30+
</markdown:SfMarkdownViewer>
31+
32+
</ContentPage>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace MarkdownViewerGettingStarted
2+
{
3+
public partial class MainPage : ContentPage
4+
{
5+
public MainPage()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net10.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
6+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
7+
8+
<!-- Note for MacCatalyst:
9+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
10+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
11+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
12+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
13+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
14+
15+
<OutputType>Exe</OutputType>
16+
<RootNamespace>MarkdownViewerGettingStarted</RootNamespace>
17+
<UseMaui>true</UseMaui>
18+
<SingleProject>true</SingleProject>
19+
<ImplicitUsings>enable</ImplicitUsings>
20+
<Nullable>enable</Nullable>
21+
22+
<!-- Enable XAML source generation for faster build times and improved performance.
23+
This generates C# code from XAML at compile time instead of runtime inflation.
24+
To disable, remove this line.
25+
For individual files, you can override by setting Inflator metadata:
26+
<MauiXaml Update="MyPage.xaml" Inflator="Default" /> (reverts to defaults: Runtime for Debug, XamlC for Release)
27+
<MauiXaml Update="MyPage.xaml" Inflator="Runtime" /> (force runtime inflation) -->
28+
<MauiXamlInflator>SourceGen</MauiXamlInflator>
29+
30+
<!-- Display name -->
31+
<ApplicationTitle>MarkdownViewerGettingStarted</ApplicationTitle>
32+
33+
<!-- App Identifier -->
34+
<ApplicationId>com.companyname.markdownviewergettingstarted</ApplicationId>
35+
36+
<!-- Versions -->
37+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
38+
<ApplicationVersion>1</ApplicationVersion>
39+
40+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
41+
<WindowsPackageType>None</WindowsPackageType>
42+
43+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
44+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
45+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
46+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
47+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
48+
</PropertyGroup>
49+
50+
<ItemGroup>
51+
<!-- App Icon -->
52+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
53+
54+
<!-- Splash Screen -->
55+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
56+
57+
<!-- Images -->
58+
<MauiImage Include="Resources\Images\*" />
59+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
60+
61+
<!-- Custom Fonts -->
62+
<MauiFont Include="Resources\Fonts\*" />
63+
64+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
65+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
66+
</ItemGroup>
67+
68+
<ItemGroup>
69+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
70+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
71+
<PackageReference Include="Syncfusion.Maui.MarkdownViewer" Version="*" />
72+
</ItemGroup>
73+
74+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Extensions.Logging;
2+
using Syncfusion.Maui.Core.Hosting;
3+
4+
namespace MarkdownViewerGettingStarted
5+
{
6+
public static class MauiProgram
7+
{
8+
public static MauiApp CreateMauiApp()
9+
{
10+
var builder = MauiApp.CreateBuilder();
11+
builder
12+
.UseMauiApp<App>()
13+
.ConfigureSyncfusionCore()
14+
.ConfigureFonts(fonts =>
15+
{
16+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
17+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
18+
});
19+
20+
#if DEBUG
21+
builder.Logging.AddDebug();
22+
#endif
23+
24+
return builder.Build();
25+
}
26+
}
27+
}
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>

0 commit comments

Comments
 (0)