Skip to content

Commit

Permalink
Markup renderings can be used together
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Apr 27, 2024
1 parent 686a5eb commit e638983
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 58 deletions.
57 changes: 16 additions & 41 deletions ProjectTemplates/ShinyApp/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,19 @@
"replaces": "{DOTNET_TFM}",
"defaultValue": "net8.0"
},
"markuptype": {
"useblazor":{
"type": "parameter",
"datatype": "choice",
"description": "This will setup a standard XAML template, a MAUI Blazor project, or a C# powered markup using the .NET MAUI Community Toolkit",
"displayName": "UI Markup Type",
"choices": [{
"choice": "XAML",
"description": "XAML"
},{
"choice": "Blazor",
"description": "Blazor"
},{
"choice": "CSharp",
"description": "CSharp"
}],
"defaultValue": "XAML",
"replaces": "{MARKUP_TYPE}"
"datatype": "bool",
"defaultValue": "false",
"description": "Add Blazor Hybrid Support",
"displayName": "Add Blazor Hybrid Support"
},
"usecsharpmarkup":{
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Add C# Markup - MAUI Community Toolkit",
"displayName": "Add C# Markup - MAUI Community Toolkit"
},
"applicationId": {
"type": "parameter",
Expand Down Expand Up @@ -602,22 +598,7 @@
"type": "computed",
"datatype": "bool",
"value": "(usepushfirebase == false && usemsal == false)"
},
"usexaml":{
"type": "computed",
"datatype": "bool",
"value": "(markuptype == \"XAML\")"
},
"useblazor":{
"type": "computed",
"datatype": "bool",
"value": "(markuptype == \"Blazor\")"
},
"usecsharpmarkup":{
"type": "computed",
"datatype": "bool",
"value": "(markuptype == \"CSharp\")"
},
},
"usehttp":{
"type": "computed",
"datatype": "bool",
Expand Down Expand Up @@ -739,24 +720,18 @@
"condition": "(authservice == false || refit == false)",
"exclude": "Services/Impl/IApiClient.cs"
},
{
"condition": "(usecsharpmarkup == true)",
"exclude": [
"MainPage.xaml",
"MainPage.xaml.cs"
]
},
{
"condition": "(usecsharpmarkup == false)",
"exclude": "MainPage.cs"
},
"exclude": "CSharpMarkupPage.cs"
},
{
"condition": "(storereview == false)",
"exclude": "Platforms/Android/proguard.cfg"
},
{
"condition": "(useblazor == false)",
"exclude":[
"BlazorPage.*",
"*.razor",
"Components/**",
"wwwroot/**"
Expand Down
13 changes: 13 additions & 0 deletions ProjectTemplates/ShinyApp/BlazorPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ShinyApp"
x:Class="ShinyApp.BlazorPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentPage>
11 changes: 11 additions & 0 deletions ProjectTemplates/ShinyApp/BlazorPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace ShinyApp;


public partial class BlazorPage : ContentPage
{
public BlazorPage()
{
this.InitializeComponent();
}
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using static CommunityToolkit.Maui.Markup.GridRowsColumns;

class MainPage : ContentPage
public class CSharpMarkupPage : ContentPage
{
public MainPage()
public CSharpMarkupPage()
{
//Content = new Grid
//{
Expand Down
15 changes: 0 additions & 15 deletions ProjectTemplates/ShinyApp/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--#if (useblazor)-->
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ShinyApp"
x:Class="ShinyApp.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentPage>
<!--#else-->
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ShinyApp"
x:DataType="local:MainViewModel"
x:Class="ShinyApp.MainPage">
</ContentPage>
<!--#endif-->

0 comments on commit e638983

Please sign in to comment.