Skip to content

Commit 55f99e8

Browse files
authored
Add required attribute to IMarkupExtension (#513)
* Initial commit. * Add required attribute.
1 parent e203d28 commit 55f99e8

Some content is hidden

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

58 files changed

+1496
-1
lines changed

9.0/PlatformIntegration/NativeEmbeddingDemo/TestHarnessApp/TestHarnessApp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949
<ItemGroup>
5050
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
51-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
5251
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-rc.1.24431.7" />
5352
</ItemGroup>
5453

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}") = "MarkupExtensions", "MarkupExtensions\MarkupExtensions.csproj", "{7337A77C-33CD-4CA2-B8B1-6816F0F21478}"
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+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{7337A77C-33CD-4CA2-B8B1-6816F0F21478}.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
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:MarkupExtensions"
5+
x:Class="MarkupExtensions.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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace MarkupExtensions;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new NavigationPage(new MainPage());
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace MarkupExtensions
2+
{
3+
static class AppConstants
4+
{
5+
public static double NormalFontSize = 18;
6+
public static string Idiom = DeviceInfo.Idiom.ToString();
7+
}
8+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace MarkupExtensions
2+
{
3+
[AcceptEmptyServiceProvider]
4+
public class HslColorExtension : IMarkupExtension<Color>
5+
{
6+
public float H { get; set; }
7+
public float S { get; set; }
8+
public float L { get; set; }
9+
public float A { get; set; } = 1.0f;
10+
11+
public Color ProvideValue(IServiceProvider serviceProvider)
12+
{
13+
return Color.FromHsla(H, S, L, A);
14+
}
15+
16+
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
17+
{
18+
return (this as IMarkupExtension<Color>).ProvideValue(serviceProvider);
19+
}
20+
}
21+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.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);net9.0-tizen</TargetFrameworks> -->
8+
9+
<!-- Note for MacCatalyst:
10+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
11+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
12+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
13+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
14+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
15+
16+
<OutputType>Exe</OutputType>
17+
<RootNamespace>MarkupExtensions</RootNamespace>
18+
<UseMaui>true</UseMaui>
19+
<SingleProject>true</SingleProject>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
22+
<!-- Display name -->
23+
<ApplicationTitle>MarkupExtensions</ApplicationTitle>
24+
25+
<!-- App Identifier -->
26+
<ApplicationId>com.companyname.markupextensions</ApplicationId>
27+
28+
<!-- Versions -->
29+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
30+
<ApplicationVersion>1</ApplicationVersion>
31+
32+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
33+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
34+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
35+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
36+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
37+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
38+
</PropertyGroup>
39+
40+
<ItemGroup>
41+
<!-- App Icon -->
42+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
43+
44+
<!-- Splash Screen -->
45+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
46+
47+
<!-- Images -->
48+
<MauiImage Include="Resources\Images\*" />
49+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
50+
51+
<!-- Custom Fonts -->
52+
<MauiFont Include="Resources\Fonts\*" />
53+
54+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
55+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
56+
</ItemGroup>
57+
58+
<ItemGroup>
59+
<None Remove="Resources\Fonts\ionicons.ttf" />
60+
</ItemGroup>
61+
62+
<ItemGroup>
63+
<MauiXaml Update="Views\AppThemeBindingDemoPage.xaml">
64+
<Generator>MSBuild:Compile</Generator>
65+
</MauiXaml>
66+
<MauiXaml Update="Views\ArrayDemoPage.xaml">
67+
<Generator>MSBuild:Compile</Generator>
68+
</MauiXaml>
69+
<MauiXaml Update="Views\FontImageDemoPage.xaml">
70+
<Generator>MSBuild:Compile</Generator>
71+
</MauiXaml>
72+
<MauiXaml Update="Views\HslColorDemoPage.xaml">
73+
<Generator>MSBuild:Compile</Generator>
74+
</MauiXaml>
75+
<MauiXaml Update="Views\MainPage.xaml">
76+
<Generator>MSBuild:Compile</Generator>
77+
</MauiXaml>
78+
<MauiXaml Update="Views\NullDemoPage.xaml">
79+
<Generator>MSBuild:Compile</Generator>
80+
</MauiXaml>
81+
<MauiXaml Update="Views\OnIdiomDemoPage.xaml">
82+
<Generator>MSBuild:Compile</Generator>
83+
</MauiXaml>
84+
<MauiXaml Update="Views\OnPlatformDemoPage.xaml">
85+
<Generator>MSBuild:Compile</Generator>
86+
</MauiXaml>
87+
<MauiXaml Update="Views\ReferenceDemoPage.xaml">
88+
<Generator>MSBuild:Compile</Generator>
89+
</MauiXaml>
90+
<MauiXaml Update="Views\StaticDemoPage.xaml">
91+
<Generator>MSBuild:Compile</Generator>
92+
</MauiXaml>
93+
<MauiXaml Update="Views\TypeDemoPage.xaml">
94+
<Generator>MSBuild:Compile</Generator>
95+
</MauiXaml>
96+
</ItemGroup>
97+
98+
<ItemGroup>
99+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
100+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-rc.1.24431.7" />
101+
</ItemGroup>
102+
103+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace MarkupExtensions;
2+
3+
public static class MauiProgram
4+
{
5+
public static MauiApp CreateMauiApp()
6+
{
7+
var builder = MauiApp.CreateBuilder();
8+
builder
9+
.UseMauiApp<App>()
10+
.ConfigureFonts(fonts =>
11+
{
12+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
13+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
14+
fonts.AddFont("ionicons.ttf", "Ionicons");
15+
});
16+
17+
return builder.Build();
18+
}
19+
}
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 MarkupExtensions;
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+
}

0 commit comments

Comments
 (0)