diff --git a/.gitignore b/.gitignore index 9491a2f..68f960e 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,6 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd +/templates/FmgLib.MauiMarkup.TemplateApp/bin/* +/templates/FmgLib.MauiMarkup.TemplateApp/obj/* diff --git a/FmgLib.MauiMarkup.sln b/FmgLib.MauiMarkup.sln index 1254df7..83398f8 100644 --- a/FmgLib.MauiMarkup.sln +++ b/FmgLib.MauiMarkup.sln @@ -5,10 +5,6 @@ VisualStudioVersion = 17.9.34414.90 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{A4956394-4BE4-4C5A-BDD3-59F439A1FD98}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{8254CDF2-DB64-4ED2-8305-85CB3461710E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup", "libs\FmgLib.MauiMarkup\FmgLib.MauiMarkup.csproj", "{7FE9B834-EEF6-4D65-8EE8-B085997B1F26}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FE0466FD-1CF3-4D08-B3B2-B6E0EB476831}" ProjectSection(SolutionItems) = preProject LICENSE.txt = LICENSE.txt @@ -19,30 +15,28 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneratedExam", "sample\Gen EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8E033618-BADE-4A6C-AC14-56EF722D8F61}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup.Generator.Test", "tests\FmgLib.MauiMarkup.Generator.Test\FmgLib.MauiMarkup.Generator.Test.csproj", "{57DB4E88-894E-46B4-A6FA-6BD3630BEB4B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyOrderApp", "sample\MyOrderApp\MyOrderApp.csproj", "{ACC42464-7EAF-446F-8CD9-3D64C97ADA1A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyFinance", "sample\MyFinance\MyFinance.csproj", "{0F20FD8E-1997-4953-8B28-FC2AB893CF4F}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9F405AEA-B646-47DD-A094-B4DA5F087273}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup", "src\FmgLib.MauiMarkup\FmgLib.MauiMarkup.csproj", "{D2A04B78-1200-47E4-8DD4-F36BBB31B323}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup.Generator", "src\FmgLib.MauiMarkup.Generator\FmgLib.MauiMarkup.Generator.csproj", "{A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup.Generator.Test", "tests\FmgLib.MauiMarkup.Generator.Test\FmgLib.MauiMarkup.Generator.Test.csproj", "{DAC53472-0370-4B41-8A21-ECB0B8BD660C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7FE9B834-EEF6-4D65-8EE8-B085997B1F26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FE9B834-EEF6-4D65-8EE8-B085997B1F26}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FE9B834-EEF6-4D65-8EE8-B085997B1F26}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FE9B834-EEF6-4D65-8EE8-B085997B1F26}.Release|Any CPU.Build.0 = Release|Any CPU {61CFBCD6-A21C-46CA-8264-5F21A0467F18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {61CFBCD6-A21C-46CA-8264-5F21A0467F18}.Debug|Any CPU.Build.0 = Debug|Any CPU {61CFBCD6-A21C-46CA-8264-5F21A0467F18}.Release|Any CPU.ActiveCfg = Release|Any CPU {61CFBCD6-A21C-46CA-8264-5F21A0467F18}.Release|Any CPU.Build.0 = Release|Any CPU - {57DB4E88-894E-46B4-A6FA-6BD3630BEB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57DB4E88-894E-46B4-A6FA-6BD3630BEB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57DB4E88-894E-46B4-A6FA-6BD3630BEB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57DB4E88-894E-46B4-A6FA-6BD3630BEB4B}.Release|Any CPU.Build.0 = Release|Any CPU {ACC42464-7EAF-446F-8CD9-3D64C97ADA1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACC42464-7EAF-446F-8CD9-3D64C97ADA1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACC42464-7EAF-446F-8CD9-3D64C97ADA1A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU @@ -55,16 +49,29 @@ Global {0F20FD8E-1997-4953-8B28-FC2AB893CF4F}.Release|Any CPU.ActiveCfg = Release|Any CPU {0F20FD8E-1997-4953-8B28-FC2AB893CF4F}.Release|Any CPU.Build.0 = Release|Any CPU {0F20FD8E-1997-4953-8B28-FC2AB893CF4F}.Release|Any CPU.Deploy.0 = Release|Any CPU + {D2A04B78-1200-47E4-8DD4-F36BBB31B323}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2A04B78-1200-47E4-8DD4-F36BBB31B323}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2A04B78-1200-47E4-8DD4-F36BBB31B323}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2A04B78-1200-47E4-8DD4-F36BBB31B323}.Release|Any CPU.Build.0 = Release|Any CPU + {A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D}.Release|Any CPU.Build.0 = Release|Any CPU + {DAC53472-0370-4B41-8A21-ECB0B8BD660C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAC53472-0370-4B41-8A21-ECB0B8BD660C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAC53472-0370-4B41-8A21-ECB0B8BD660C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAC53472-0370-4B41-8A21-ECB0B8BD660C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {7FE9B834-EEF6-4D65-8EE8-B085997B1F26} = {8254CDF2-DB64-4ED2-8305-85CB3461710E} {61CFBCD6-A21C-46CA-8264-5F21A0467F18} = {A4956394-4BE4-4C5A-BDD3-59F439A1FD98} - {57DB4E88-894E-46B4-A6FA-6BD3630BEB4B} = {8E033618-BADE-4A6C-AC14-56EF722D8F61} {ACC42464-7EAF-446F-8CD9-3D64C97ADA1A} = {A4956394-4BE4-4C5A-BDD3-59F439A1FD98} {0F20FD8E-1997-4953-8B28-FC2AB893CF4F} = {A4956394-4BE4-4C5A-BDD3-59F439A1FD98} + {D2A04B78-1200-47E4-8DD4-F36BBB31B323} = {9F405AEA-B646-47DD-A094-B4DA5F087273} + {A0F9BAC1-D4D6-4ADB-9CA5-F536FCA0F06D} = {9F405AEA-B646-47DD-A094-B4DA5F087273} + {DAC53472-0370-4B41-8A21-ECB0B8BD660C} = {8E033618-BADE-4A6C-AC14-56EF722D8F61} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2698E1E7-D253-457B-AF1B-6754123E0A11} diff --git a/README.md b/README.md index 5d3198d..c5299e0 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,3 @@ -### Free .NET MAUI Libraries by FmgLib - - -| NuGet Package | Link | Repo Info | -|--------------|------|-------| -| `FmgLib.MauiMarkup` | [![NuGet](https://buildstats.info/nuget/FmgLib.MauiMarkup?includePreReleases=true)](https://www.nuget.org/packages/FmgLib.MauiMarkup/) | [![GitHub Stars](https://img.shields.io/github/stars/FmgLib/FmgLib.MauiMarkup?style=flat-square&color=blue)](https://github.com/FmgLib/FmgLib.MauiMarkup/stargazers) [![GitHub Forks](https://img.shields.io/github/forks/FmgLib/FmgLib.MauiMarkup?style=flat-square&color=green)](https://github.com/FmgLib/FmgLib.MauiMarkup/forks) [![GitHub last-commit](https://img.shields.io/github/last-commit/FmgLib/FmgLib.MauiMarkup?style=flat-square)](https://github.com/FmgLib/FmgLib.MauiMarkup/commits) | -| `FmgLib.MauiMarkup.Template` | [![NuGet](https://buildstats.info/nuget/FmgLib.MauiMarkup.Template?includePreReleases=true)](https://www.nuget.org/packages/FmgLib.MauiMarkup.Template/) | - | - - -### Free .NET MAUI Project Templates by FmgLib - -| Template | Link | -|--------------|------| -| `FmgLib .NET MAUI Markup App` | [![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/r/FmgLib.FmgLibMauiMarkupTemplate)](https://marketplace.visualstudio.com/items?itemName=FmgLib.FmgLibMauiMarkupTemplate&ssr=false#overview) [![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/i/FmgLib.FmgLibMauiMarkupTemplate)](https://marketplace.visualstudio.com/items?itemName=FmgLib.FmgLibMauiMarkupTemplate&ssr=false#overview)| - - - # Getting Started ### Creating a new FmgLib.MauiMarkup project from CLI @@ -132,7 +115,6 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif | Maui bağlı özelliği | FmgLib.MauiMarkup metodu | |-|-| - |`Shell.ItemTemplate`|`ShellItemTemplate()`| |`FlyoutBase.ContextFlyout`|`ContextFlyout()`| |`Grid.Column`|`Column()`| |`Grid.Row`|`Row()`| @@ -148,7 +130,7 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif |`BindableLayout.ItemTemplate`|`BindableLayoutItemTemplate()`| |`BindableLayout.TemplateSelector`|`BindableItemTemplateSelector()`| |`Shell.PresentationMode`|`ShellPresentationMode()`| - |`ShellBackgroundColor`|`ShellBackgroundColor()`| + |`Shell.BackgroundColor`|`ShellBackgroundColor()`| |`Shell.ForegroundColor`|`ShellForegroundColor()`| |`Shell.TitleColor`|`ShellTitleColor()`| |`Shell.DisabledColor`|`ShellDisabledColor()`| @@ -156,8 +138,27 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif |`Shell.NavBarHasShadow`|`ShellNavBarHasShadow()`| |`Shell.NavBarIsVisible`|`ShellNavBarIsVisible()`| |`Shell.TitleView`|`ShellTitleView()`| + |`Shell.TabBarBackgroundColor`|`ShellTabBarBackgroundColor()`| + |`Shell.TabBarForegroundColor`|`ShellTabBarForegroundColor()`| + |`Shell.TabBarTitleColor`|`ShellTabBarTitleColor()`| + |`Shell.TabBarDisabledColor`|`ShellTabBarDisabledColor()`| + |`Shell.TabBarUnselectedColor`|`ShellTabBarUnselectedColor()`| + |`Shell.TabBarIsVisible`|`ShellTabBarIsVisible()`| + |`Shell.FlyoutBackdrop`|`ShellFlyoutBackdrop()`| + |`Shell.FlyoutBehavior`|`ShellFlyoutBehavior()`| + |`Shell.FlyoutHeight`|`ShellFlyoutHeight()`| + |`Shell.FlyoutWidth`|`ShellFlyoutWidth()`| + |`Shell.FlyoutItemIsVisible`|`ShellFlyoutItemIsVisible()`| + |`Shell.BackButtonBehavior`|`ShellBackButtonBehavior()`| + |`Shell.ItemTemplate`|`ShellItemTemplate()`| + |`Shell.MenuItemTemplate`|`ShellMenuItemTemplate()`| + |`Shell.SearchHandler`|`ShellSearchHandler()`| |`NavigationPage.HasNavigationBar`|`NavigationPageHasNavigationBar()`| |`NavigationPage.BackButtonTitle`|`NavigationPageBackButtonTitle()`| + |`NavigationPage.HasBackButton`|`NavigationPageHasBackButton()`| + |`NavigationPage.IconColor`|`NavigationPageIconColor()`| + |`NavigationPage.TitleIconImageSource`|`NavigationPageTitleIconImageSource()`| + |`NavigationPage.TitleView`|`NavigationPageTitleView()`| |`SemanticProperties.Hint`|`SemanticHint()`| |`SemanticProperties.Description`|`SemanticDescription()`| |`SemanticProperties.HeadingLevel`|`SemanticHeadingLevel()`| diff --git a/sample/MyFinance/MyFinance.csproj b/sample/MyFinance/MyFinance.csproj index 5154272..7ef8573 100644 --- a/sample/MyFinance/MyFinance.csproj +++ b/sample/MyFinance/MyFinance.csproj @@ -68,7 +68,7 @@ - + diff --git a/sample/MyFinance/Views/AddOrEditPage.cs b/sample/MyFinance/Views/AddOrEditPage.cs index 33272fe..6df84fc 100644 --- a/sample/MyFinance/Views/AddOrEditPage.cs +++ b/sample/MyFinance/Views/AddOrEditPage.cs @@ -31,7 +31,7 @@ public override void Build() .PickerButtonAreaTemplate(() => new HorizontalStackLayout() .Margin(10) - .AlignBottomEnd() + .AlignBottomRight() .Spacing(10) .Children( new Button() @@ -57,7 +57,7 @@ public override void Build() new CheckEdit() .Label("Gelir") - .AlignStart() + .AlignLeft() .IsChecked(e => e.Path("OperationItem.IsIncome")), new Button() diff --git a/sample/MyFinance/Views/ChartPage.cs b/sample/MyFinance/Views/ChartPage.cs index 8028f25..e523c8f 100644 --- a/sample/MyFinance/Views/ChartPage.cs +++ b/sample/MyFinance/Views/ChartPage.cs @@ -35,7 +35,7 @@ public override void Build() .TextColor(Green) .FontSize(12) .Column(1) - .AlignBottomEnd(), + .AlignBottomRight(), new Label() .Text(e => e.Path("TotalExpense")) @@ -43,7 +43,7 @@ public override void Build() .FontSize(12) .Column(1) .Row(1) - .AlignTopEnd() + .AlignTopRight() ) ), diff --git a/sample/MyFinance/Views/ItemsPage.cs b/sample/MyFinance/Views/ItemsPage.cs index 3239ab0..3ea3ded 100644 --- a/sample/MyFinance/Views/ItemsPage.cs +++ b/sample/MyFinance/Views/ItemsPage.cs @@ -14,69 +14,64 @@ public override void Build() .RowDefinitions(e => e.Star(.7).Star(9.3)) .Spacing(10) .Margin(10) - .Children(() => - { - return [ - new Grid() - .ColumnDefinitions(e => e.Star(8).Star(1).Star(1)) - .Spacing(20) - .FillHorizontal() - .Children(() => - { - return [ - new Label() - .Text("İŞLEMLER") - .FontAttributes(Bold) - .FontSize(34) - .AlignStart(), + .Children( + new Grid() + .ColumnDefinitions(e => e.Star(8).Star(1).Star(1)) + .Spacing(20) + .FillHorizontal() + .Children( + new Label() + .Text("İŞLEMLER") + .FontAttributes(Bold) + .FontSize(34) + .AlignLeft(), - new ImageButton() - .Source("wallet.png") - .SizeRequest(40, 40) - .Command(e => e.Path("GotoAddPageCommand")) - .Column(1), + new ImageButton() + .Source("wallet.png") + .SizeRequest(40, 40) + .Command(e => e.Path("GotoAddPageCommand")) + .Column(1), - new ImageButton() - .Source("filter.png") - .SizeRequest(40, 40) - .Command(e => e.Path("ShowFilterPopupCommand")) - .Column(2) - .AlignEnd() - ]; - }), + new ImageButton() + .Source("filter.png") + .SizeRequest(40, 40) + .Command(e => e.Path("ShowFilterPopupCommand")) + .Column(2) + .AlignRight() + ), - new ShimmerView() - .WaveWidth(0.7) - .WaveOpacity(0.8) - .WaveDuration(new TimeSpan(0, 0, 0, 1)) - .IsLoading(e => e.Path("IsLoadingItems")) - .Row(1) - .LoadingView(() => - { - return new DXCollectionView() - .ItemsSource(e => e.Path("LoadingItems")) - .IsScrollBarVisible(false) - .ItemTemplate(() => - new Border() - .Margin(5, 5) - .BackgroundColor(LightGray) - .StrokeShape(new RoundRectangle().CornerRadius(25)) - .HeightRequest(60) - .StrokeThickness(0) - ); - }) - .Content(() => - { - return new DXCollectionView() - .Assign(out var collectionView) - .ItemsSource(e => e.Path("Items")) - .IsRefreshing(e => e.Path("IsRefreshing").BindingMode(TwoWay)) - .IsLoadMoreEnabled(e => e.Path("IsLoadMoreEnabled")) - .LoadMoreCommand(e => e.Path("LoadMoreCommand")) - .IndicatorColor(DeepSkyBlue) - .ItemTemplate(() => - new SwipeContainer() - .StartSwipeItems( + new ShimmerView() + .WaveWidth(0.7) + .WaveOpacity(0.8) + .WaveDuration(new TimeSpan(0, 0, 0, 1)) + .IsLoading(e => e.Path("IsLoadingItems")) + .Row(1) + .LoadingView( + new DXCollectionView() + .ItemsSource(e => e.Path("LoadingItems")) + .IsScrollBarVisible(false) + .ItemTemplate(() => + new Border() + .Margin(5, 5) + .BackgroundColor(LightGray) + .StrokeShape(new RoundRectangle().CornerRadius(25)) + .HeightRequest(60) + .StrokeThickness(0) + ) + ) + .Content( + new DXCollectionView() + .Assign(out var collectionView) + .ItemsSource(e => e.Path("Items")) + .IsRefreshing(e => e.Path("IsRefreshing").BindingMode(TwoWay)) + .IsLoadMoreEnabled(e => e.Path("IsLoadMoreEnabled")) + .LoadMoreCommand(e => e.Path("LoadMoreCommand")) + .IndicatorColor(DeepSkyBlue) + .ItemTemplate(() => + new SwipeContainer() + .StartSwipeItems( + new SwipeItemCollection + { new SwipeItem() { BackgroundColor = Orange @@ -88,8 +83,12 @@ public override void Build() AddOrEditPageViewModel.Id = ((OperationItemsVM)e.Item).Id; await AppShell.Current.GoToAsync($"//{nameof(AddOrEditPage)}"); }) - ) - .EndSwipeItems( + } + + ) + .EndSwipeItems( + new SwipeItemCollection + { new SwipeItem() { BackgroundColor = Red @@ -101,224 +100,217 @@ public override void Build() BindingContext.DeleteId = ((OperationItemsVM)e.Item).Id; BindingContext.IsDeletePopupShow = true; }) - ) - .ItemView( - new DXStackLayout() - .Children_ContentProp( - new Grid() - .RowDefinitions(e => e.Star().Star()) - .ColumnDefinitions(e => e.Star(1).Star(6).Star(3)) - .Spacing(5) - .Margin(5) - .Children( - new DXImage() - .Source(e => e.Path("Icon")) - .SizeRequest(30, 30) - .RowSpan(2), + } + ) + .ItemView( + new DXStackLayout() + .Children( + new Grid() + .RowDefinitions(e => e.Star().Star()) + .ColumnDefinitions(e => e.Star(1).Star(6).Star(3)) + .Spacing(5) + .Margin(5) + .Children( + new DXImage() + .Source(e => e.Path("Icon")) + .SizeRequest(30, 30) + .RowSpan(2), - new Label() - .FontAttributes(Bold) - .TextColor(Black) - .Text(e => e.Path("Title")) - .AlignBottom() - .Column(1), + new Label() + .FontAttributes(Bold) + .TextColor(Black) + .Text(e => e.Path("Title")) + .AlignBottom() + .Column(1), - new Label() - .TextColor(DarkGray) - .Text(e => e.Path("Description")) - .FontSize(12) - .FontAttributes(Italic) - .AlignTop() - .Column(1) - .Row(1), + new Label() + .TextColor(DarkGray) + .Text(e => e.Path("Description")) + .FontSize(12) + .FontAttributes(Italic) + .AlignTop() + .Column(1) + .Row(1), - new Label() - .Text(e => e.Path("Date")) - .TextColor(DarkGray) - .FontSize(10) - .Column(2) - .AlignBottomEnd(), + new Label() + .Text(e => e.Path("Date")) + .TextColor(DarkGray) + .FontSize(10) + .Column(2) + .AlignBottomRight(), - new Label() - .Text(e => e.Path("Amount")) - .TextColor(e => e.Path("Color")) - .FontSize(12) - .Column(2) - .Row(1) - .AlignTopEnd() - ), + new Label() + .Text(e => e.Path("Amount")) + .TextColor(e => e.Path("Color")) + .FontSize(12) + .Column(2) + .Row(1) + .AlignTopRight() + ), - new BoxView() - .Color(LightGray) - .HeightRequest(1) - ) + new BoxView() + .Color(LightGray) + .HeightRequest(1) ) - ); - }), + ) + ) + ), - new DXPopup() - .IsOpen(e => e.Path("IsShowPopup")) - .RowSpan(2) - .AnimationDuration(new TimeSpan(0, 0, 0, 1)) - .VerticalAlignment(PopupVerticalAlignment.Center) - .HorizontalAlignment(PopupHorizontalAlignment.Center) - .AllowShadow(true) - .AllowScrim(false) - .ShadowHorizontalOffset(20) - .ShadowVerticalOffset(20) - .CornerRadius(20) - .ShadowRadius(20) - .ShadowColor(Gray) - .Content(() => - { - return new Grid() - .WidthRequest(250) - .HeightRequest(200) - .Padding(15) - .Margin(10) - .RowDefinitions(e => e.Absolute(50).Absolute(50).Absolute(50)) - .RowSpacing(10) - .Children(() =>{ - return [ - new ComboBoxEdit() - .SelectedIndex(e => e.Path("OperationType")) - .ItemsSource(new List - { - "Tümü", - "Gelir", - "Gider" - }), + new DXPopup() + .IsOpen(e => e.Path("IsShowPopup")) + .RowSpan(2) + .AnimationDuration(new TimeSpan(0, 0, 0, 1)) + .VerticalAlignment(PopupVerticalAlignment.Center) + .HorizontalAlignment(PopupHorizontalAlignment.Center) + .AllowShadow(true) + .AllowScrim(false) + .ShadowHorizontalOffset(20) + .ShadowVerticalOffset(20) + .CornerRadius(20) + .ShadowRadius(20) + .ShadowColor(Gray) + .Content( + new Grid() + .WidthRequest(250) + .HeightRequest(200) + .Padding(15) + .Margin(10) + .RowDefinitions(e => e.Absolute(50).Absolute(50).Absolute(50)) + .RowSpacing(10) + .Children( + new ComboBoxEdit() + .SelectedIndex(e => e.Path("OperationType")) + .ItemsSource(new List + { + "Tümü", + "Gelir", + "Gider" + }), - new ComboBoxEdit() - .SelectedIndex(e => e.Path("DateType")) - .Row(1) - .ItemsSource(new List - { - "Son 1 Haftalık Veri", - "Son 1 Aylık Veri", - "Son 6 Aylık Veri", - "Son 1 Yıllık Veri" - }), + new ComboBoxEdit() + .SelectedIndex(e => e.Path("DateType")) + .Row(1) + .ItemsSource(new List + { + "Son 1 Haftalık Veri", + "Son 1 Aylık Veri", + "Son 6 Aylık Veri", + "Son 1 Yıllık Veri" + }), - new Button() - .Text("Filtrele") - .FontAttributes(Bold) - .Command(e => e.Path("ApplyFilterCommand")) - .Row(2) - ]; - }); - }), + new Button() + .Text("Filtrele") + .FontAttributes(Bold) + .Command(e => e.Path("ApplyFilterCommand")) + .Row(2) + ) + ), - new DXPopup() - .IsOpen(e => e.Path("IsDeletePopupShow")) - .RowSpan(2) - .AnimationDuration(new TimeSpan(0, 0, 0, 1)) - .VerticalAlignment(PopupVerticalAlignment.Center) - .HorizontalAlignment(PopupHorizontalAlignment.Center) - .AllowShadow(true) - .AllowScrim(false) - .ShadowHorizontalOffset(20) - .ShadowVerticalOffset(20) - .CornerRadius(20) - .ShadowRadius(20) - .ShadowColor(Gray) - .Content(() => - { - return new Grid() - .WidthRequest(250) - .HeightRequest(130) - .Padding(15) - .Margin(10) - .RowDefinitions(e => e.Absolute(50).Absolute(50)) - .RowSpacing(5) - .Children(() => { - return [ - new Label().Text("Silmek istediğinizden emin misiniz?"), + new DXPopup() + .IsOpen(e => e.Path("IsDeletePopupShow")) + .RowSpan(2) + .AnimationDuration(new TimeSpan(0, 0, 0, 1)) + .VerticalAlignment(PopupVerticalAlignment.Center) + .HorizontalAlignment(PopupHorizontalAlignment.Center) + .AllowShadow(true) + .AllowScrim(false) + .ShadowHorizontalOffset(20) + .ShadowVerticalOffset(20) + .CornerRadius(20) + .ShadowRadius(20) + .ShadowColor(Gray) + .Content( + new Grid() + .WidthRequest(250) + .HeightRequest(130) + .Padding(15) + .Margin(10) + .RowDefinitions(e => e.Absolute(50).Absolute(50)) + .RowSpacing(5) + .Children( + new Label().Text("Silmek istediğinizden emin misiniz?"), - new HorizontalStackLayout() - .Spacing(10) - .Row(1) - .AlignBottomEnd() - .Children( - new Button() - .Text("Hayır") - .FontAttributes(Bold) - .BackgroundColor(DeepSkyBlue) - .Command(e => e.Path("CancelCommand")), + new HorizontalStackLayout() + .Spacing(10) + .Row(1) + .AlignBottomRight() + .Children( + new Button() + .Text("Hayır") + .FontAttributes(Bold) + .BackgroundColor(DeepSkyBlue) + .Command(e => e.Path("CancelCommand")), - new Button() - .Text("Evet") - .FontAttributes(Bold) - .BackgroundColor(Red) - .Command(e => e.Path("YesCommand")) - .Row(2) - ) - ]; - }); - }), + new Button() + .Text("Evet") + .FontAttributes(Bold) + .BackgroundColor(Red) + .Command(e => e.Path("YesCommand")) + .Row(2) + ) + ) + ), - new DXPopup() - .IsOpen(e => e.Path("IsInfoPopupShow")) - .AllowScrim(false) - .AnimationDuration(new TimeSpan(0, 0, 0, 1)) - .VerticalAlignment(PopupVerticalAlignment.Center) - .HorizontalAlignment(PopupHorizontalAlignment.Center) - .BackgroundColor(e => e.Path("InfoPopupColor")) - .RowSpan(3) - .Content(() => - { - return new Grid() - .WidthRequest(250) - .HeightRequest(150) + new DXPopup() + .IsOpen(e => e.Path("IsInfoPopupShow")) + .AllowScrim(false) + .AnimationDuration(new TimeSpan(0, 0, 0, 1)) + .VerticalAlignment(PopupVerticalAlignment.Center) + .HorizontalAlignment(PopupHorizontalAlignment.Center) + .BackgroundColor(e => e.Path("InfoPopupColor")) + .RowSpan(3) + .Content( + new Grid() + .WidthRequest(250) + .HeightRequest(150) + .Padding(0) + .Children( + new Frame() + .CornerRadius(25) + .BackgroundColor(e => e.Path("InfoPopupColor")) + .BorderColor(e => e.Path("InfoPopupColor")) + .FillBothDirections() .Padding(0) - .Children( - new Frame() - .CornerRadius(25) - .BackgroundColor(e => e.Path("InfoPopupColor")) - .BorderColor(e => e.Path("InfoPopupColor")) + .Content( + new Grid() + .RowDefinitions(e => e.Star(2).Star(7).Star(1)) .FillBothDirections() - .Padding(0) - .Content( - new Grid() - .RowDefinitions(e => e.Star(2).Star(7).Star(1)) - .FillBothDirections() - .Margin(10) - .Padding(10) - .Children( - new Label() - .Text(e => e.Path("InfoPopupTitle")) - .FontAttributes(Bold) - .FontSize(18) - .TextColor(Black) - .Center() - .Row(0), + .Margin(10) + .Padding(10) + .Children( + new Label() + .Text(e => e.Path("InfoPopupTitle")) + .FontAttributes(Bold) + .FontSize(18) + .TextColor(Black) + .Center() + .Row(0), - new Label() - .Text(e => e.Path("InfoPopupDesc")) - .FontAttributes(Italic) - .LineBreakMode(WordWrap) - .FontSize(12) - .TextColor(Black) - .Center() - .Row(1), + new Label() + .Text(e => e.Path("InfoPopupDesc")) + .FontAttributes(Italic) + .LineBreakMode(WordWrap) + .FontSize(12) + .TextColor(Black) + .Center() + .Row(1), - new Button() - .Text("OK") - .TextColor(Black) - .FontAttributes(Bold) - .FontSize(15) - .Row(2) - .HeightRequest(30) - .BackgroundColor(DeepSkyBlue) - .CenterHorizontal() - .Padding(0) - .Command(e => e.Path("ClosePopupCommand")) - ) + new Button() + .Text("OK") + .TextColor(Black) + .FontAttributes(Bold) + .FontSize(15) + .Row(2) + .HeightRequest(30) + .BackgroundColor(DeepSkyBlue) + .CenterHorizontal() + .Padding(0) + .Command(e => e.Path("ClosePopupCommand")) ) - ); - }) - ]; - }) + ) + ) + ) + ) ); } diff --git a/sample/MyFinance/Views/LoginPage.cs b/sample/MyFinance/Views/LoginPage.cs index 1b94d89..e0ec1d1 100644 --- a/sample/MyFinance/Views/LoginPage.cs +++ b/sample/MyFinance/Views/LoginPage.cs @@ -72,7 +72,7 @@ public override void Build() .Children( new CheckEdit() .Label("Remember for 30 days") - .AlignStart() + .AlignLeft() .IsChecked(e => e.Path("Login.IsRememberMe")), new Label() @@ -81,7 +81,7 @@ public override void Build() .TextDecorations(Underline) .TextCenterVertical() .Column(1) - .AlignEnd() + .AlignRight() ) ), diff --git a/sample/MyFinance/Views/MainPage.cs b/sample/MyFinance/Views/MainPage.cs index a9c8efc..dd4b887 100644 --- a/sample/MyFinance/Views/MainPage.cs +++ b/sample/MyFinance/Views/MainPage.cs @@ -7,20 +7,19 @@ public partial class MainPage(MainPageViewModel viewModel) : FmgLibContentPage - { - return new Grid() + .Content( + new Grid() .RowDefinitions(e => e.Star(.8).Star(1.2).Star(1.2).Star(6.8)) .Spacing(15) - .Margin(20, 20, 20, 10) + .Margin(20,20,20,10) .Children( new HorizontalStackLayout() - .AlignStart() + .AlignLeft() .Spacing(5) .Children( new DXImage() .Source("profile.png") - .SizeRequest(60, 60), + .SizeRequest(60,60), new VerticalStackLayout() .CenterVertical() @@ -48,7 +47,7 @@ public override void Build() new Grid() .RowDefinitions(e => e.Star().Star()) .ColumnDefinitions(e => e.Star(7).Star(3)) - .Spacing(10, 3) + .Spacing(10,3) .Children( new Label() .Text(e => e.Path("TotalBalance")) @@ -61,7 +60,7 @@ public override void Build() .TextColor(Green) .FontSize(12) .Column(1) - .AlignBottomEnd(), + .AlignBottomRight(), new Label() .Text(e => e.Path("TotalExpense")) @@ -69,7 +68,7 @@ public override void Build() .FontSize(12) .Column(1) .Row(1) - .AlignTopEnd() + .AlignTopRight() ) ), @@ -123,7 +122,7 @@ public override void Build() .FontAttributes(Bold) .TextColor(Black) .Text("Son 10 İşlem ") - .AlignEnd(), + .AlignRight(), new Border() .StrokeThickness(1) @@ -141,7 +140,7 @@ public override void Build() .Children( new DXImage() .Source(e => e.Path("Icon")) - .SizeRequest(30, 30) + .SizeRequest(30,30) .RowSpan(2), new Label() @@ -165,7 +164,7 @@ public override void Build() .TextColor(DarkGray) .FontSize(10) .Column(2) - .AlignBottomEnd(), + .AlignBottomRight(), new Label() .Text(e => e.Path("Amount")) @@ -173,12 +172,12 @@ public override void Build() .FontSize(12) .Column(2) .Row(1) - .AlignTopEnd() + .AlignTopRight() ) ) ) ) - ); - }); + ) + ); } -} \ No newline at end of file +} diff --git a/sample/MyOrderApp/Imports.cs b/sample/MyOrderApp/Imports.cs index a241873..7fe9e72 100644 --- a/sample/MyOrderApp/Imports.cs +++ b/sample/MyOrderApp/Imports.cs @@ -16,6 +16,5 @@ global using MyOrderApp.Converters; global using MyOrderApp.Extensions; // Static -global using static CommunityToolkit.Maui.Markup.GridRowsColumns; global using static Microsoft.Maui.Graphics.Colors; global using MC = Microsoft.Maui.Controls; diff --git a/sample/MyOrderApp/MyOrderApp.csproj b/sample/MyOrderApp/MyOrderApp.csproj index 93ecb73..c99536b 100644 --- a/sample/MyOrderApp/MyOrderApp.csproj +++ b/sample/MyOrderApp/MyOrderApp.csproj @@ -78,7 +78,6 @@ - diff --git a/sample/MyOrderApp/Views/BasketPage.cs b/sample/MyOrderApp/Views/BasketPage.cs index 7e87325..69af552 100644 --- a/sample/MyOrderApp/Views/BasketPage.cs +++ b/sample/MyOrderApp/Views/BasketPage.cs @@ -72,14 +72,14 @@ public override void Build() //.Bind(Label.TextProperty, "Product.Name") .FontSize(11) .FontAttributes(FontAttributes.Italic) - .AlignStart() + .AlignTopLeft() .LineBreakMode(LineBreakMode.TailTruncation), new Frame() .BorderColor(Colors.DarkGray) .HeightRequest(50) .WidthRequest(120) - .AlignStart() + .AlignTopLeft() .Padding(0) .Content( new HorizontalStackLayout() @@ -128,7 +128,7 @@ public override void Build() new VerticalStackLayout() .Spacing(20) .Column(2) - .AlignEnd() + .AlignBottomRight() .Children( new Image() .Source("remove.png") @@ -178,7 +178,7 @@ public override void Build() //.Bind(Label.TextProperty, nameof(BindingContext.TotalProductPrice)) .Column(1) .Row(0) - .AlignEnd(), + .AlignBottomRight(), new Label() .Text("KDV") @@ -190,7 +190,7 @@ public override void Build() //.Bind(Label.TextProperty, nameof(BindingContext.TotalKdv)) .Column(1) .Row(1) - .AlignEnd(), + .AlignBottomRight(), new Label() .Text("TOPLAM") @@ -206,7 +206,7 @@ public override void Build() .FontSize(16) .Column(1) .Row(2) - .AlignEnd(), + .AlignBottomRight(), new Button() .Text("SİPARİŞ ET") diff --git a/sample/MyOrderApp/Views/CategoriesPage.cs b/sample/MyOrderApp/Views/CategoriesPage.cs index 6ee1218..5fca6b1 100644 --- a/sample/MyOrderApp/Views/CategoriesPage.cs +++ b/sample/MyOrderApp/Views/CategoriesPage.cs @@ -61,7 +61,7 @@ public override void Build() .Source("chevron.png") .SizeRequest(25,25) .Column(1) - .AlignEnd() + .AlignBottomRight() .Assign(out var image) .Triggers( new MultiTrigger(typeof(Image)) diff --git a/sample/MyOrderApp/Views/FavoritesPage.cs b/sample/MyOrderApp/Views/FavoritesPage.cs index 2fd25c8..e4a0f02 100644 --- a/sample/MyOrderApp/Views/FavoritesPage.cs +++ b/sample/MyOrderApp/Views/FavoritesPage.cs @@ -72,7 +72,7 @@ public override void Build() .Source(e => e.Path(nameof(ProductVM.IsFavorite)).Converter(new BoolToFavoriteImageConverter())) //.Bind(ImageButton.SourceProperty, nameof(ProductVM.IsFavorite), converter: new BoolToFavoriteImageConverter()) .BackgroundColor(Colors.Transparent) - .AlignStart() + .AlignTopLeft() .SizeRequest(30, 30) .Command(BindingContext.ChangeFavoriteCommand) //.Bind(ImageButton.CommandParameterProperty, ".") @@ -115,7 +115,7 @@ public override void Build() //.Bind(Label.TextProperty, nameof(ProductVM.Name)) .FontAttributes(FontAttributes.Bold) .FontSize(11) - .AlignStart() + .AlignTopLeft() .LineBreakMode(LineBreakMode.TailTruncation) .FontAutoScalingEnabled(true), diff --git a/sample/MyOrderApp/Views/HomePage.cs b/sample/MyOrderApp/Views/HomePage.cs index 307f8b9..ede7327 100644 --- a/sample/MyOrderApp/Views/HomePage.cs +++ b/sample/MyOrderApp/Views/HomePage.cs @@ -82,7 +82,7 @@ public override void Build() .FontSize(18) .CenterVertical() .Column(0) - .AlignStart(), + .AlignTopLeft(), new Label() @@ -90,7 +90,7 @@ public override void Build() .FontSize(15) .CenterVertical() .Column(1) - .AlignEnd() + .AlignBottomRight() .TextDecorations(TextDecorations.Underline) .GestureRecognizers( new TapGestureRecognizer() @@ -135,7 +135,7 @@ public override void Build() .Source(e => e.Path(nameof(ProductVM.IsFavorite)).Converter(new BoolToFavoriteImageConverter())) //.Bind(ImageButton.SourceProperty, nameof(ProductVM.IsFavorite), converter: new BoolToFavoriteImageConverter()) .BackgroundColor(Colors.Transparent) - .AlignStart() + .AlignTopLeft() .SizeRequest(30, 30) .Command(BindingContext.ChangeFavoriteCommand) //.Bind(ImageButton.CommandParameterProperty, ".") @@ -177,7 +177,7 @@ public override void Build() //.Bind(Label.TextProperty, nameof(ProductVM.Name)) .FontAttributes(FontAttributes.Bold) .FontSize(11) - .AlignStart() + .AlignTopLeft() .LineBreakMode(LineBreakMode.TailTruncation) .FontAutoScalingEnabled(true), @@ -247,7 +247,7 @@ public override void Build() .FontSize(18) .CenterVertical() .Column(0) - .AlignStart(), + .AlignTopLeft(), new Label() @@ -255,7 +255,7 @@ public override void Build() .FontSize(15) .CenterVertical() .Column(1) - .AlignEnd() + .AlignBottomRight() .TextDecorations(TextDecorations.Underline) .GestureRecognizers( new TapGestureRecognizer() @@ -264,15 +264,15 @@ public override void Build() ), new FlexLayout() - .ItemsSources(BindingContext.Categories) + .BindableLayoutItemsSource(BindingContext.Categories) .Assign(out var flex) .Wrap(FlexWrap.Wrap) .FlexBasis(FlexBasis.Auto) - .ItemTemplates(new DataTemplate(() => + .BindableLayoutItemTemplate(new DataTemplate(() => new Frame() .CornerRadius(15) - .BorderColor(Colors.LightGray) - .BackgroundColor(Colors.LightGray) + .BorderColor(LightGray) + .BackgroundColor(LightGray) .MinimumHeightRequest(30) .WidthRequest(180) .Padding(0) diff --git a/sample/MyOrderApp/Views/ProductsPage.cs b/sample/MyOrderApp/Views/ProductsPage.cs index 565c873..3cda3fc 100644 --- a/sample/MyOrderApp/Views/ProductsPage.cs +++ b/sample/MyOrderApp/Views/ProductsPage.cs @@ -72,7 +72,7 @@ public override void Build() new ImageButton() .Source(e => e.Path(nameof(ProductVM.IsFavorite)).Converter(new BoolToFavoriteImageConverter())) .BackgroundColor(Colors.Transparent) - .AlignStart() + .AlignTopLeft() .SizeRequest(30, 30) .Command(BindingContext.ChangeFavoriteCommand) .CommandParameter(e => e.Path(".")), @@ -110,7 +110,7 @@ public override void Build() .Text(e => e.Path(nameof(ProductVM.Name))) .FontAttributes(FontAttributes.Bold) .FontSize(11) - .AlignStart() + .AlignTopLeft() .LineBreakMode(LineBreakMode.TailTruncation) .FontAutoScalingEnabled(true), diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.AnimateTo.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.AnimateTo.cs new file mode 100644 index 0000000..b895fa9 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.AnimateTo.cs @@ -0,0 +1,26 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_AnimateTo(PropInfo info, string transformationName) + { + + if (mainSymbol.IsSealed) + builder.Append($@" + public static Task Animate{info.propertyName}To(this {info.MainSymbolName} self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null)"); + else + builder.Append($@" + public static Task Animate{info.propertyName}To(this T self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null) + where T : {info.MainSymbolName}"); + + + builder.Append($@" + {{ + {info.propertyTypeName} fromValue = self.{info.propertyName}; + var transform = (double t) => Transformations.{transformationName}(fromValue, value, t); + var callback = ({info.propertyTypeName} actValue) => {{ self.{info.propertyName} = actValue; }}; + return Transformations.AnimateAsync<{info.propertyTypeName}>(self, ""Animate{info.propertyName}To"", transform, callback, length, easing); + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.BindingBuilder.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.BindingBuilder.cs new file mode 100644 index 0000000..b7f1a38 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.BindingBuilder.cs @@ -0,0 +1,71 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_BindablePropertyBuilder(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_BindablePropertyBuilder_Sealed(info); + else + GenerateExtensionMethod_BindablePropertyBuilder_Normal(info); + } + + void GenerateExtensionMethod_BindablePropertyBuilder_Sealed(PropInfo info) + { + builder.Append($@" + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, Func, IPropertyBuilder<{info.propertyTypeName}>> configure) + {{ + var context = new PropertyContext<{info.propertyTypeName}>(self, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + void GenerateExtensionMethod_BindablePropertyBuilder_Normal(PropInfo info) + { + builder.Append($@" + public static T {info.propertyName}(this T self, Func, IPropertyBuilder<{info.propertyTypeName}>> configure) + where T : {info.MainSymbolName} + {{ + var context = new PropertyContext<{info.propertyTypeName}>(self, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + + void GenerateExtensionMethod_BindablePropertyBuilder(AttachedFieldInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_BindablePropertyBuilder_Sealed(info); + else + GenerateExtensionMethod_BindablePropertyBuilder_Normal(info); + } + + void GenerateExtensionMethod_BindablePropertyBuilder_Sealed(AttachedFieldInfo info) + { + builder.Append($@" + public static {info.DeclaringTypeName} {info.propertyName}(this {info.DeclaringTypeName} self, Func, IPropertyBuilder<{info.ReturnTypeName}>> configure) + {{ + var context = new PropertyContext<{info.propertyTypeName}>(self, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + void GenerateExtensionMethod_BindablePropertyBuilder_Normal(AttachedFieldInfo info) + { + builder.Append($@" + public static T {info.propertyName}(this T self, Func, IPropertyBuilder<{info.ReturnTypeName}>> configure) + where T : {info.DeclaringTypeName} + {{ + var context = new PropertyContext<{info.ReturnTypeName}>(self, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ContentProp.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ContentProp.cs new file mode 100644 index 0000000..2e42bc8 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ContentProp.cs @@ -0,0 +1,131 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_ContentProp_Single(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_ContentProp_Single_Sealed(info); + else + GenerateExtensionMethod_ContentProp_Single_Normal(info); + } + + void GenerateExtensionMethod_ContentProp_List(PropInfo info, string elementTypeName, string fluentMethodName = "") + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_ContentProp_List_Sealed(info, elementTypeName, fluentMethodName); + else + GenerateExtensionMethod_ContentProp_List_Normal(info, elementTypeName, fluentMethodName); + } + + + + void GenerateExtensionMethod_ContentProp_Single_Sealed(PropInfo info) + { + builder.Append($@" + public static {info.MainSymbolName} {info.propertyName}_ContentProp(this {info.MainSymbolName} self, + {info.propertyTypeName} {info.camelCaseName}) + {{ + self.{info.propertyName} = {info.camelCaseName}; + return self; + }} + + public static {info.MainSymbolName} {info.propertyName}_ContentProp(this {info.MainSymbolName} self, + Func<{info.propertyTypeName}> configure) + {{ + var {info.camelCaseName} = configure(); + self.{info.propertyName} = {info.camelCaseName}; + return self; + }} + "); + } + + void GenerateExtensionMethod_ContentProp_Single_Normal(PropInfo info) + { + builder.Append($@" + public static T {info.propertyName}_ContentProp(this T self, + {info.propertyTypeName} {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + self.{info.propertyName} = {info.camelCaseName}; + return self; + }} + + public static T {info.propertyName}_ContentProp(this T self, + Func<{info.propertyTypeName}> configure) + where T : {info.MainSymbolName} + {{ + var {info.camelCaseName} = configure(); + self.{info.propertyName} = {info.camelCaseName}; + return self; + }} + "); + } + + + + void GenerateExtensionMethod_ContentProp_List_Sealed(PropInfo info, string elementTypeName, string fluentMethodName = "") + { + var tail = info.propertyTypeName.EndsWith("?") ? "?" : ""; + builder.Append($@" + public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self, + IList<{elementTypeName}> {info.camelCaseName}) + {{ + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self, + params {elementTypeName}[] {info.camelCaseName}) + {{ + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self, + Func<{elementTypeName}[]> configure) + {{ + var {info.camelCaseName} = configure(); + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + "); + } + + void GenerateExtensionMethod_ContentProp_List_Normal(PropInfo info, string elementTypeName, string fluentMethodName = "") + { + var tail = info.propertyTypeName.EndsWith("?") ? "?" : ""; + builder.Append($@" + public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this T self, + IList<{elementTypeName}> {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this T self, + params {elementTypeName}[] {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this T self, + Func<{elementTypeName}[]> configure) + where T : {info.MainSymbolName} + {{ + var {info.camelCaseName} = configure(); + foreach (var item in {info.camelCaseName}) + self.{info.propertyName}{tail}.Add(item); + return self; + }} + "); + } +} diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.DataTemplate.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.DataTemplate.cs new file mode 100644 index 0000000..b1107ed --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.DataTemplate.cs @@ -0,0 +1,35 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_DataTemplate(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_DataTemplate_Sealed(info); + else + GenerateExtensionMethod_DataTemplate_Normal(info); + } + + void GenerateExtensionMethod_DataTemplate_Sealed(PropInfo info) + { + builder.Append($@" + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, System.Func loadTemplate) + {{ + {info.dataTemplateAssignmentString} + return self; + }} + "); + } + + void GenerateExtensionMethod_DataTemplate_Normal(PropInfo info) + { + builder.Append($@" + public static T {info.propertyName}(this T self, System.Func loadTemplate) + where T : {info.MainSymbolName} + {{ + {info.dataTemplateAssignmentString} + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Events.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Events.cs new file mode 100644 index 0000000..df585fa --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Events.cs @@ -0,0 +1,94 @@ +using System; +using System.Linq; +using Microsoft.CodeAnalysis; + +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateEventMethod(ISymbol @event) + { + var eventSymbol = (IEventSymbol)@event; + var eventHandler = eventSymbol.AddMethod.Parameters.First(); + var eventHandlerType = ((INamedTypeSymbol)eventHandler.Type); + + var existInBases = false; + Helpers.LoopDownToObject(mainSymbol.BaseType, type => + { + existInBases = (type + .GetMembers() + .FirstOrDefault(e => + e.Kind == SymbolKind.Event && + e.DeclaredAccessibility == Accessibility.Public && + e.Name.Equals(eventSymbol.Name, StringComparison.Ordinal)) != null); + + return existInBases; + }); + + if (!existInBases && !Helpers.NotGenerateList.Contains(eventSymbol.Name)) + { + if (mainSymbol.IsSealed) + { + GenerateEventMethodHandler_Sealed(eventSymbol); + GenerateEventMethodNoArgs_Sealed(eventSymbol); + } + else + { + GenerateEventMethodHandler_Normal(eventSymbol); + GenerateEventMethodNoArgs_Normal(eventSymbol); + } + isGeneratedExtension = true; + } + } + + + void GenerateEventMethodHandler_Sealed(IEventSymbol eventSymbol) + { + builder.Append($@" + public static {mainSymbol.ToDisplayString()} On{eventSymbol.Name}(this {mainSymbol.ToDisplayString()} self, {((INamedTypeSymbol)eventSymbol.Type).ToDisplayString()} handler) + {{ + self.{eventSymbol.Name} += handler; + return self; + }} + "); + } + + void GenerateEventMethodHandler_Normal(IEventSymbol eventSymbol) + { + builder.Append($@" + public static T On{eventSymbol.Name}(this T self, {((INamedTypeSymbol)eventSymbol.Type).ToDisplayString()} handler) + where T : {mainSymbol.ToDisplayString()} + {{ + self.{eventSymbol.Name} += handler; + return self; + }} + "); + } + + void GenerateEventMethodNoArgs_Sealed(IEventSymbol eventSymbol) + { + var parameterCount = ((INamedTypeSymbol)eventSymbol.Type).DelegateInvokeMethod.Parameters.Length; + if (parameterCount <= 2) + builder.Append($@" + public static {mainSymbol.ToDisplayString()} On{eventSymbol.Name}(this {mainSymbol.ToDisplayString()} self, System.Action<{mainSymbol.ToDisplayString()}> action) + {{ + {(parameterCount == 2 ? $"self.{eventSymbol.Name} += (o, arg) => action(self);" : parameterCount == 1 ? $"self.{eventSymbol.Name} += (o) => action(self);" : parameterCount == 0 ? $"self.{eventSymbol.Name} += () => action(self);" : string.Empty)} + return self; + }} + "); + } + + void GenerateEventMethodNoArgs_Normal(IEventSymbol eventSymbol) + { + var parameterCount = ((INamedTypeSymbol)eventSymbol.Type).DelegateInvokeMethod.Parameters.Length; + if (parameterCount <= 2) + builder.Append($@" + public static T On{eventSymbol.Name}(this T self, System.Action action) + where T : {mainSymbol.ToDisplayString()} + {{ + {(parameterCount == 2 ? $"self.{eventSymbol.Name} += (o, arg) => action(self);" : parameterCount == 1 ? $"self.{eventSymbol.Name} += (o) => action(self);" : parameterCount == 0 ? $"self.{eventSymbol.Name} += () => action(self);" : string.Empty)} + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.GetValue.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.GetValue.cs new file mode 100644 index 0000000..3856bf7 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.GetValue.cs @@ -0,0 +1,33 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_GetValue(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_GetValue_Sealed(info); + else + GenerateExtensionMethod_GetValue_Normal(info); + } + + void GenerateExtensionMethod_GetValue_Sealed(PropInfo info) + { + builder.Append($@" + public static {info.propertyTypeName} Get{info.propertyName}Value(this {info.MainSymbolName} self) + {{ + return ({info.propertyTypeName})self.GetValue({info.BindablePropertyName}); + }} + "); + } + + void GenerateExtensionMethod_GetValue_Normal(PropInfo info) + { + builder.Append($@" + public static {info.propertyTypeName} Get{info.propertyName}Value(this T self) + where T : {info.MainSymbolName} + {{ + return ({info.propertyTypeName})self.GetValue({info.BindablePropertyName}); + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ITextAlignment.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ITextAlignment.cs new file mode 100644 index 0000000..5be0aae --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ITextAlignment.cs @@ -0,0 +1,258 @@ +using Microsoft.CodeAnalysis; + +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethods_ITextAlignment(ISymbol symbol) + { + builder.Append($@" + + public static T AlignText(this T self, TextAlignment vertical, TextAlignment horizontal) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, vertical); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, horizontal); + return self; + }} + + public static SettersContext AlignText(this SettersContext self, TextAlignment vertical, TextAlignment horizontal) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = vertical }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = horizontal }}); + return self; + }} + + public static T TextCenterHorizontal(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Center); + return self; + }} + + public static SettersContext TextCenterHorizontal(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }}); + return self; + }} + + public static T TextCenterVertical(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Center); + return self; + }} + + public static SettersContext TextCenterVertical(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Center }}); + return self; + }} + + public static T TextCenter(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Center); + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Center); + return self; + }} + + public static SettersContext TextCenter(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Center }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }}); + return self; + }} + + public static T TextTop(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Start); + return self; + }} + + public static SettersContext TextTop(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Start }}); + return self; + }} + + public static T TextBottom(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.End); + return self; + }} + + public static SettersContext TextBottom(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.End }}); + return self; + }} + + public static T TextTopLeft(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Start); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Start); + return self; + }} + + public static SettersContext TextTopLeft(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Start }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Start }}); + return self; + }} + + public static T TextBottomLeft(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.End); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Start); + return self; + }} + + public static SettersContext TextBottomLeft(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.End }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Start }}); + return self; + }} + + public static T TextTopCenter(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Start); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Center); + return self; + }} + + public static SettersContext TextTopCenter(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Start }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }}); + return self; + }} + + public static T TextBottomCenter(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.End); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Center); + return self; + }} + + public static SettersContext TextBottomCenter(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.End }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }}); + return self; + }} + + public static T TextCenterRight(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Center); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.End); + return self; + }} + + public static SettersContext TextCenterRight(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Center }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.End }}); + return self; + }} + + public static T TextCenterLeft(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Center); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Start); + return self; + }} + + public static SettersContext TextCenterLeft(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Center }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Start }}); + return self; + }} + + public static T TextTopRight(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.Start); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.End); + return self; + }} + + public static SettersContext TextTopRight(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.Start }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.End }}); + return self; + }} + + public static T TextBottomRight(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.VerticalTextAlignmentProperty, TextAlignment.End); + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.End); + return self; + }} + + public static SettersContext TextBottomRight(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.VerticalTextAlignmentProperty, Value = TextAlignment.End }}); + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.End }}); + return self; + }} + + public static T TextLeft(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.Start); + return self; + }} + + public static SettersContext TextLeft(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.Start }}); + return self; + }} + + public static T TextRight(this T self) + where T : {symbol.ToDisplayString()} + {{ + self.SetValue({symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, TextAlignment.End); + return self; + }} + + public static SettersContext TextRight(this SettersContext self) + where T : {symbol.ToDisplayString()} + {{ + self.XamlSetters.Add(new Setter {{ Property = {symbol.ToDisplayString()}.HorizontalTextAlignmentProperty, Value = TextAlignment.End }}); + return self; + }} + + "); + } +} + diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Lists.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Lists.cs new file mode 100644 index 0000000..1098b4a --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Lists.cs @@ -0,0 +1,59 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_List(PropInfo info, string elementTypeName) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_List_Sealed(info, elementTypeName); + else + GenerateExtensionMethod_List_Normal(info, elementTypeName); + } + + void GenerateExtensionMethod_List_Sealed(PropInfo info, string elementTypeName) + { + var tail = info.propertyTypeName.EndsWith("?") ? "?" : ""; + builder.Append($@" + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, + IList<{elementTypeName}> {info.camelCaseName}) + {{ + foreach (var item in {info.camelCaseName}) + {info.accessedWith}.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, + params {elementTypeName}[] {info.camelCaseName}) + {{ + foreach (var item in {info.camelCaseName}) + {info.accessedWith}.{info.propertyName}{tail}.Add(item); + return self; + }} + "); + } + + void GenerateExtensionMethod_List_Normal(PropInfo info, string elementTypeName) + { + var tail = info.propertyTypeName.EndsWith("?") ? "?" : ""; + builder.Append($@" + public static T {info.propertyName}(this T self, + IList<{elementTypeName}> {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + foreach (var item in {info.camelCaseName}) + {info.accessedWith}.{info.propertyName}{tail}.Add(item); + return self; + }} + + public static T {info.propertyName}(this T self, + params {elementTypeName}[] {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + foreach (var item in {info.camelCaseName}) + {info.accessedWith}.{info.propertyName}{tail}.Add(item); + return self; + }} + "); + } + +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.BindingBuilder.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.BindingBuilder.cs new file mode 100644 index 0000000..72c0a3f --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.BindingBuilder.cs @@ -0,0 +1,71 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_SettersBuilder(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_SettersBuilder_Sealed(info); + else + GenerateExtensionMethod_SettersBuilder_Normal(info); + } + + void GenerateExtensionMethod_SettersBuilder_Sealed(PropInfo info) + { + builder.Append($@" + public static SettersContext<{info.MainSymbolName}> {info.propertyName}(this SettersContext<{info.MainSymbolName}> self, Func, IPropertySettersBuilder<{info.propertyTypeName}>> configure) + {{ + var context = new PropertySettersContext<{info.propertyTypeName}>(self.XamlSetters, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + void GenerateExtensionMethod_SettersBuilder_Normal(PropInfo info) + { + builder.Append($@" + public static SettersContext {info.propertyName}(this SettersContext self, Func, IPropertySettersBuilder<{info.propertyTypeName}>> configure) + where T : {info.MainSymbolName} + {{ + var context = new PropertySettersContext<{info.propertyTypeName}>(self.XamlSetters, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + + void GenerateExtensionMethod_SettersBuilder(AttachedFieldInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_SettersBuilder_Sealed(info); + else + GenerateExtensionMethod_SettersBuilder_Normal(info); + } + + void GenerateExtensionMethod_SettersBuilder_Sealed(AttachedFieldInfo info) + { + builder.Append($@" + public static SettersContext<{info.DeclaringTypeName}> {info.propertyName}(this SettersContext<{info.DeclaringTypeName}> self, Func, IPropertySettersBuilder<{info.ReturnTypeName}>> configure) + {{ + var context = new PropertySettersContext<{info.ReturnTypeName}>(self.XamlSetters, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } + + void GenerateExtensionMethod_SettersBuilder_Normal(AttachedFieldInfo info) + { + builder.Append($@" + public static SettersContext {info.propertyName}(this SettersContext self, Func, IPropertySettersBuilder<{info.ReturnTypeName}>> configure) + where T : {info.DeclaringTypeName} + {{ + var context = new PropertySettersContext<{info.ReturnTypeName}>(self.XamlSetters, {info.BindablePropertyName}); + configure(context).Build(); + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.Value.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.Value.cs new file mode 100644 index 0000000..4316ea3 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.Value.cs @@ -0,0 +1,71 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_Setters(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_Setters_Sealed(info); + else + GenerateExtensionMethod_Setters_Normal(info); + } + + void GenerateExtensionMethod_Setters_Sealed(PropInfo info) + { + builder.Append($@" + public static SettersContext<{info.MainSymbolName}> {info.propertyName}(this SettersContext<{info.MainSymbolName}> self, + {info.propertyTypeName} {info.camelCaseName}) + {{ + self.XamlSetters.Add(new Setter {{ Property = {info.BindablePropertyName}, Value = {info.camelCaseName} }}); + return self; + }} + "); + } + + void GenerateExtensionMethod_Setters_Normal(PropInfo info) + { + builder.Append($@" + public static SettersContext {info.propertyName}(this SettersContext self, + {info.propertyTypeName} {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + self.XamlSetters.Add(new Setter {{ Property = {info.BindablePropertyName}, Value = {info.camelCaseName} }}); + return self; + }} + "); + } + + + void GenerateExtensionMethod_Setters(AttachedFieldInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_Setters_Sealed(info); + else + GenerateExtensionMethod_Setters_Normal(info); + } + + void GenerateExtensionMethod_Setters_Sealed(AttachedFieldInfo info) + { + builder.Append($@" + public static SettersContext<{info.DeclaringTypeName}> {info.propertyName}(this SettersContext<{info.DeclaringTypeName}> self, + {info.ReturnTypeName} {info.camelCaseName}) + {{ + self.XamlSetters.Add(new Setter {{ Property = {info.BindablePropertyName}, Value = {info.camelCaseName} }}); + return self; + }} + "); + } + + void GenerateExtensionMethod_Setters_Normal(AttachedFieldInfo info) + { + builder.Append($@" + public static SettersContext {info.propertyName}(this SettersContext self, + {info.ReturnTypeName} {info.camelCaseName}) + where T : {info.DeclaringTypeName} + {{ + self.XamlSetters.Add(new Setter {{ Property = {info.BindablePropertyName}, Value = {info.camelCaseName} }}); + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Value.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Value.cs new file mode 100644 index 0000000..fd68f23 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Value.cs @@ -0,0 +1,109 @@ +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + void GenerateExtensionMethod_Value(PropInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_Value_Sealed(info); + else + GenerateExtensionMethod_Value_Normal(info); + } + + void GenerateExtensionMethod_Value_Sealed(PropInfo info) + { + builder.Append($@" + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, + {info.propertyTypeName} {info.camelCaseName}) + {{ + {info.valueAssignmentString} + return self; + }} + + public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, + Func<{info.propertyTypeName}> configure) + {{ + var {info.camelCaseName} = configure(); + {(info.IsBindableProperty ? + $@"self.SetValue({info.BindablePropertyName}, {info.camelCaseName});" : + $"{info.accessedWith}.{info.propertyName} = {info.camelCaseName}; ")} + return self; + }} + "); + } + + void GenerateExtensionMethod_Value_Normal(PropInfo info) + { + builder.Append($@" + public static T {info.propertyName}(this T self, + {info.propertyTypeName} {info.camelCaseName}) + where T : {info.MainSymbolName} + {{ + {info.valueAssignmentString} + return self; + }} + + public static T {info.propertyName}(this T self, + Func<{info.propertyTypeName}> configure) + where T : {info.MainSymbolName} + {{ + var {info.camelCaseName} = configure(); + {(info.IsBindableProperty ? + $@"self.SetValue({info.BindablePropertyName}, {info.camelCaseName});" : + $"{info.accessedWith}.{info.propertyName} = {info.camelCaseName}; ")} + return self; + }} + "); + } + + + void GenerateExtensionMethod_Value(AttachedFieldInfo info) + { + if (mainSymbol.IsSealed) + GenerateExtensionMethod_Value_Sealed(info); + else + GenerateExtensionMethod_Value_Normal(info); + } + + void GenerateExtensionMethod_Value_Sealed(AttachedFieldInfo info) + { + builder.Append($@" + public static {info.DeclaringTypeName} {info.propertyName}(this {info.DeclaringTypeName} self, + {info.ReturnTypeName} {info.camelCaseName}) + {{ + {info.valueAssignmentString} + return self; + }} + + public static {info.DeclaringTypeName} {info.propertyName}(this {info.DeclaringTypeName} self, + Func<{info.ReturnTypeName}> configure) + {{ + var {info.camelCaseName} = configure(); + {$@"self.SetValue({info.BindablePropertyName}, {info.camelCaseName});"} + return self; + }} + "); + } + + void GenerateExtensionMethod_Value_Normal(AttachedFieldInfo info) + { + builder.Append($@" + public static T {info.propertyName}(this T self, + {info.ReturnTypeName} {info.camelCaseName}) + where T : {info.DeclaringTypeName} + {{ + {info.valueAssignmentString} + return self; + }} + + public static T {info.propertyName}(this T self, + Func<{info.ReturnTypeName}> configure) + where T : {info.DeclaringTypeName} + {{ + var {info.camelCaseName} = configure(); + {$@"self.SetValue({info.BindablePropertyName}, {info.camelCaseName});"} + return self; + }} + "); + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.cs b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.cs new file mode 100644 index 0000000..c82b92d --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.cs @@ -0,0 +1,272 @@ +using Microsoft.CodeAnalysis; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public partial class ExtensionGenerator +{ + readonly GeneratorExecutionContext context; + readonly INamedTypeSymbol mainSymbol; + readonly bool isBindableObject; + readonly bool isVisualElement; + bool isGeneratedExtension = false; + readonly AttachedModel attachedModel = null; + IPropertySymbol childProp; + List bindablePropertyNames; + + StringBuilder builder; + + public ExtensionGenerator(GeneratorExecutionContext context, INamedTypeSymbol symbol) + { + this.context = context; + this.mainSymbol = symbol; + this.isBindableObject = Helpers.IsBindableObject(mainSymbol); + this.isVisualElement = Helpers.IsVisualElement(mainSymbol); + } + + public ExtensionGenerator(GeneratorExecutionContext context, AttachedModel attachedModel) + { + this.context = context; + this.mainSymbol = attachedModel.MainSymbol; + this.isBindableObject = Helpers.IsBindableObject(mainSymbol); + this.isVisualElement = Helpers.IsVisualElement(mainSymbol); + this.attachedModel = attachedModel; + } + + public (string, string, bool) Build() + { + builder = new StringBuilder(); + builder.AppendLine("//"); + builder.AppendLine("// "); + builder.AppendLine("//"); + builder.AppendLine(); + + GenerateExtensionNameSpace(); + + builder.AppendLine(); + + return ($"{mainSymbol.ContainingNamespace.ToDisplayString()}.{Helpers.GetNormalizedFileName(mainSymbol)}{(attachedModel != null ? "Attached" : "")}", builder.ToString(), isGeneratedExtension); + } + + void GenerateExtensionNameSpace() + { + var className = $"{Helpers.GetNormalizedClassName(mainSymbol)}{(attachedModel != null ? "Attached" : "")}Extension"; + + builder.Append($@" +namespace FmgLib.MauiMarkup; + +public static partial class {className} +{{"); + + GenerateClassExtensionBody(); + + builder.AppendLine($@" +}} +"); + } + + void GenerateClassExtensionBody() + { + var bindablePropertyType = context.Compilation.FindNamedType("Microsoft.Maui.Controls.BindableProperty"); + var editorBrowsableAttribute = context.Compilation.FindNamedType("System.ComponentModel.EditorBrowsableAttribute"); + + var propertiesMap = mainSymbol + .GetMembers() + .Where(_ => (_.ContainingType is INamedTypeSymbol namedTypeSymbol) && namedTypeSymbol.GetFullyQualifiedName() == mainSymbol.GetFullyQualifiedName()) + .Where(_ => _.Kind == SymbolKind.Property && + _.DeclaredAccessibility == Accessibility.Public && + !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Name == "ObsoleteAttribute" || _.AttributeClass.EnsureNotNull().Name == "Obsolete")) + .OrderBy(_ => _.Name) + .Cast() + .ToList(); + + var fieldesMap = mainSymbol + .GetMembers() + .Where(_ => (_.ContainingType is INamedTypeSymbol namedTypeSymbol) && namedTypeSymbol.GetFullyQualifiedName() == mainSymbol.GetFullyQualifiedName()) + .Where(_ => _.Kind == SymbolKind.Field && + _.DeclaredAccessibility == Accessibility.Public && + !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Name == "ObsoleteAttribute" || _.AttributeClass.EnsureNotNull().Name == "Obsolete")) + .Cast() + .ToList(); + + bindablePropertyNames = fieldesMap + .Where(_ => _.Type.GetFullyQualifiedName().Equals("Microsoft.Maui.Controls.BindableProperty") && + _.IsStatic) + .Select(_ => _.Name.Replace("PropertyKey", "").Replace("Property", "")) + .ToList(); + + var properties = propertiesMap + .Where(_ => (!_.IsReadOnly && !(_.SetMethod == null || _.SetMethod?.DeclaredAccessibility == Accessibility.Protected || _.SetMethod?.DeclaredAccessibility == Accessibility.Private)) || bindablePropertyNames.Any(e => e.Equals(_.Name))) + .ToList(); + + var readOnlyListProperties = propertiesMap + .Where(_ => _.IsReadOnly && + !bindablePropertyNames.Any(e => e.Equals(_.Name, StringComparison.InvariantCultureIgnoreCase)) && + (_.Type.Name.Contains(nameof(IList)) || _.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(IList))) || _.Type.Name.Contains(nameof(ICollection)) || _.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(ICollection)))) && + _.Type.AllInterfaces.Any(e => e.Name.Contains(nameof(IEnumerable))) && + !_.Type.Name.Equals(nameof(String), StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + + + + var events = mainSymbol + .GetMembers() + .Where(_ => _.Kind == SymbolKind.Event) + .Where(_ => _.DeclaredAccessibility == Accessibility.Public) + .Cast() + .Where(_ => !_.Name.Contains('.')) + .Where(_ => (_.ContainingType is INamedTypeSymbol namedTypeSymbol) && namedTypeSymbol.GetFullyQualifiedName() == mainSymbol.GetFullyQualifiedName()) + .Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Equals(editorBrowsableAttribute, SymbolEqualityComparer.Default))) + .Where(_ => !_.GetAttributes().Any(_ => _.AttributeClass.EnsureNotNull().Name == "ObsoleteAttribute" || _.AttributeClass.EnsureNotNull().Name == "Obsolete")) + .GroupBy(_ => _.Name, StringComparer.OrdinalIgnoreCase) + .Select(_ => _.First()) + .OrderBy(_ => _.Name) + .ToArray(); + + if (attachedModel == null) + { + foreach (var prop in readOnlyListProperties) + GenerateExtensionMethod(prop, true); + + foreach (var prop in properties) + GenerateExtensionMethod(prop); + + foreach (var @event in events) + GenerateEventMethod(@event); + + if (Helpers.IsBaseImplementationOfInterface(mainSymbol, "ITextAlignment")) + GenerateExtensionMethods_ITextAlignment(mainSymbol); + } + else + { + GenerateAttachedExtensionMethod(attachedModel); + } + } + + IEnumerable GetAllMembers(INamedTypeSymbol type) + { + foreach (var member in type.GetMembers()) + { + yield return member; + } + + if (type.BaseType != null) + { + foreach (var member in GetAllMembers(type.BaseType)) + { + yield return member; + } + } + } + + void GenerateExtension_ChildItem(IPropertySymbol propertySymbol) + { + var propertyName = propertySymbol.Name.Split(new[] { "." }, StringSplitOptions.None).Last(); + propertyName = propertyName.Equals("class", StringComparison.Ordinal) ? "@class" : propertyName; + var info = new PropInfo + { + MainSymbolName = mainSymbol.ToDisplayString(), + BindablePropertyName = $"{mainSymbol.ToDisplayString()}.{propertySymbol.Name}Property", + PropertySymbol = propertySymbol, + IsBindableProperty = bindablePropertyNames.Any(_ => _.Equals(propertySymbol.Name)) + }; + info.Build(); + + if (propertySymbol.Type is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1) + { + var listItemType = namedType.TypeArguments[0]; // Listenin eleman türü + + GenerateExtensionMethod_ContentProp_List(info, listItemType.ToDisplayString(), info.propertyName + "_ContentProp"); + } + else + { + GenerateExtensionMethod_ContentProp_Single(info); + } + } + + void GenerateExtensionMethod(IPropertySymbol propertySymbol, bool isOnlyList = false) + { + var propertyName = propertySymbol.Name.Split(new[] { "." }, StringSplitOptions.None).Last(); + propertyName = propertyName.Equals("class", StringComparison.Ordinal) ? "@class" : propertyName; + var info = new PropInfo + { + MainSymbolName = mainSymbol.ToDisplayString(), + BindablePropertyName = $"{mainSymbol.ToDisplayString()}.{propertySymbol.Name}Property", + PropertySymbol = propertySymbol, + IsBindableProperty = bindablePropertyNames.Any(_ => _.Equals(propertySymbol.Name)) + }; + info.Build(); + + if (!Helpers.NotGenerateList.Contains(info.propertyName)) + { + if (childProp != null) + GenerateExtension_ChildItem(childProp); + + if (isOnlyList) + { + string typeName = ""; + if (propertySymbol.IsReadOnly && propertySymbol.Type is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1) + typeName = namedType.TypeArguments[0].ToDisplayString(); + + else if (propertySymbol.IsReadOnly && propertySymbol.Type is INamedTypeSymbol namedListType && + namedListType.AllInterfaces.Any(e => e.Name == nameof(IEnumerable)) && + namedListType.BaseType.TypeArguments.Length == 1) + typeName = namedListType.BaseType.TypeArguments[0].ToDisplayString(); + + GenerateExtensionMethod_ContentProp_List(info, typeName); + } + else + { + GenerateExtensionMethod_Value(info); + + if (info.IsBindableProperty) + { + GenerateExtensionMethod_BindablePropertyBuilder(info); + GenerateExtensionMethod_Setters(info); + GenerateExtensionMethod_SettersBuilder(info); + } + + if (info.propertyTypeName.Equals("Microsoft.Maui.Controls.DataTemplate")) + GenerateExtensionMethod_DataTemplate(info); + + if (isVisualElement) + { + if (info.propertyTypeName.Equals("double")) + GenerateExtensionMethod_AnimateTo(info, "DoubleTransform"); + + if (info.propertyTypeName.Equals("Microsoft.Maui.Graphics.Color")) + GenerateExtensionMethod_AnimateTo(info, "ColorTransform"); + } + } + + isGeneratedExtension = true; + } + } + + void GenerateAttachedExtensionMethod(AttachedModel parameter) + { + var info = new AttachedFieldInfo + { + MainSymbol = mainSymbol, + BindablePropertyName = $"{mainSymbol.ToDisplayString()}.{parameter.PropertyName}", + ReturnTypeName = parameter.ReturnTypeName, + DeclaringTypeName = parameter.DeclaringTypeName, + PropertyName = parameter.PropertyName + }; + info.Build(); + + if (!Helpers.NotGenerateList.Contains(info.propertyName)) + { + GenerateExtensionMethod_Value(info); + GenerateExtensionMethod_BindablePropertyBuilder(info); + GenerateExtensionMethod_Setters(info); + GenerateExtensionMethod_SettersBuilder(info); + + isGeneratedExtension = true; + } + } +} \ No newline at end of file diff --git a/src/FmgLib.MauiMarkup.Generator/FmgLib.MauiMarkup.Generator.csproj b/src/FmgLib.MauiMarkup.Generator/FmgLib.MauiMarkup.Generator.csproj new file mode 100644 index 0000000..3588cc8 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/FmgLib.MauiMarkup.Generator.csproj @@ -0,0 +1,28 @@ + + + + netstandard2.0 + 12.0 + analyzers + True + True + FmgLib.MauiMarkup.Generator + false + FmgLib.MauiMarkup with C# Markup classes and fluent helper methods + FmgYazılım + Fmg Yazılım + ©2024 + https://github.com/FmgLib/FmgLib.MauiMarkup + https://github.com/FmgLib/FmgLib.MauiMarkup + false + C# Code Markup Library for .NET MAUI + xamarin,xamarin.forms,net,maui,netmaui,markup,csharpformarkup,csharp,csharpmarkup,xaml,mobile,android,ios,macos,windows,noxaml + + + + + + + + + diff --git a/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedFieldInfo.cs b/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedFieldInfo.cs new file mode 100644 index 0000000..a494281 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedFieldInfo.cs @@ -0,0 +1,34 @@ +using Microsoft.CodeAnalysis; +using System; +using System.Linq; + +namespace FmgLib.MauiMarkup.Generator.Extensions +{ + partial class AttachedFieldInfo + { + public INamedTypeSymbol MainSymbol { get; set; } + public IFieldSymbol FiledSymbol { get; set; } + public string BindablePropertyName { get; set; } + public string PropertyName { get; set; } + public string ReturnTypeName { get; set; } + public string DeclaringTypeName { get; set; } + + public string propertyName; + public string propertyTypeName; + public string camelCaseName; + public string symbolTypeName; + public string valueAssignmentString; + public string dataTemplateAssignmentString; + + public void Build() + { + FiledSymbol = MainSymbol.GetMembers(PropertyName).OfType().FirstOrDefault(); + symbolTypeName = $"{MainSymbol.ToDisplayString()}"; + propertyName = BindablePropertyName.Split(new[] { "." }, StringSplitOptions.None)[^2] + PropertyName.Replace("Property", ""); + propertyTypeName = FiledSymbol.Type.ToDisplayString(); + camelCaseName = Helpers.ToCamelCase(propertyName); + valueAssignmentString = $@"self.SetValue({BindablePropertyName}, {camelCaseName});"; + dataTemplateAssignmentString = $@"self.SetValue({BindablePropertyName}, new DataTemplate(loadTemplate));"; + } + } +} diff --git a/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedModel.cs b/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedModel.cs new file mode 100644 index 0000000..f32ce57 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Helpers/AttachedModel.cs @@ -0,0 +1,12 @@ +using Microsoft.CodeAnalysis; + +namespace FmgLib.MauiMarkup.Generator.Extensions; + +public class AttachedModel +{ + public INamedTypeSymbol MainSymbol { get; set; } + public IFieldSymbol FieldSymbol { get; set; } + public string PropertyName { get; set; } + public string ReturnTypeName { get; set; } + public string DeclaringTypeName { get; set; } +} diff --git a/src/FmgLib.MauiMarkup.Generator/Helpers/Helpers.cs b/src/FmgLib.MauiMarkup.Generator/Helpers/Helpers.cs new file mode 100644 index 0000000..7e27186 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Helpers/Helpers.cs @@ -0,0 +1,155 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace FmgLib.MauiMarkup; + +public static class Helpers +{ + public static List NotGenerateList = new() { "this[]", "Handler", "LogicalChildren" }; + + + public static string ToCamelCase(this string text) + { + if (string.IsNullOrWhiteSpace(text)) + return text; + + return char.ToLowerInvariant(text[0]) + text.Substring(1); + } + + public static INamedTypeSymbol? FindNamedType(this Compilation compilation, string typeMetadataName) + { + var typeToMauiMarkup = compilation.GetTypeByMetadataName(typeMetadataName); + + typeToMauiMarkup ??= compilation.References + .Select(compilation.GetAssemblyOrModuleSymbol) + .OfType() + .Select(assemblySymbol => assemblySymbol.GetTypeByMetadataName(typeMetadataName)) + .FirstOrDefault(_ => _ != null); + + return typeToMauiMarkup; + } + + public static string GetFullyQualifiedName(this ISymbol typeSymbol) + { + return typeSymbol.ToString(); + } + + public static T EnsureNotNull(this T? value) + => value ?? throw new InvalidOperationException(); + + public static void LoopDownToObject(INamedTypeSymbol symbol, Func func) + { + var type = symbol; + var endLoop = false; + while (!endLoop && type != null && !type.Name.Equals("Object", StringComparison.Ordinal)) + { + endLoop = func(type); + type = type.BaseType; + } + } + + public static bool IsVisualElement(INamedTypeSymbol symbol) + { + var isNavigableElement = false; + + LoopDownToObject(symbol, type => + { + if (type.ToDisplayString().Equals("Microsoft.Maui.Controls.VisualElement")) isNavigableElement = true; + return isNavigableElement; + }); + + return isNavigableElement; + } + + public static bool IsBaseImplementationOfInterface(INamedTypeSymbol symbol, string name) + { + var count = 0; + LoopDownToObject(symbol, type => + { + if (type.Interfaces.Any(e => e.Name.Equals(name))) count++; + return false; + }); + + return count == 1; + } + + public static string GetNormalizedFileName(INamedTypeSymbol type) + { + var tail = type.IsGenericType ? $".{type.TypeArguments.FirstOrDefault().Name}" : ""; + return $"{type.Name}{tail}"; + } + + public static string GetNormalizedClassName(INamedTypeSymbol type) + { + var tail = type.IsGenericType ? $"Of{type.TypeArguments.FirstOrDefault().Name}" : ""; + var prefix = type.ToDisplayString().Contains(".Shapes.") ? "Shapes" : ""; + prefix += type.ToDisplayString().Contains(".Compatibility.") ? "Compatibility" : ""; + return $"{prefix}{type.Name}{tail}"; + } + + public static bool IsBindableObject(INamedTypeSymbol symbol) + { + var isBindable = false; + + LoopDownToObject(symbol, type => + { + if (type.ToDisplayString().Equals("Microsoft.Maui.Controls.BindableObject", StringComparison.Ordinal)) isBindable = true; + return isBindable; + }); + + return isBindable; + } + + public static string? GetFullyQualifiedName(this ClassDeclarationSyntax classDeclarationSyntax) + { + if (!TryGetNamespace(classDeclarationSyntax, out string? namespaceName)) + { + return null; // or whatever you want to do in this scenario + } + + //var namespaceName = namespaceDeclarationSyntax!.Name.ToString(); + return namespaceName + "." + classDeclarationSyntax.Identifier.ToString(); + } + + public static bool TryGetNamespace(SyntaxNode? syntaxNode, out string? result) + { + // set defaults + result = null; + + if (syntaxNode == null) + { + return false; + } + + try + { + syntaxNode = syntaxNode.Parent; + + if (syntaxNode == null) + { + return false; + } + + if (syntaxNode is NamespaceDeclarationSyntax namespaceDeclarationSyntax) + { + result = namespaceDeclarationSyntax.Name.ToString(); + return true; + } + + if (syntaxNode is FileScopedNamespaceDeclarationSyntax fileScopedNamespaceDeclarationSyntax) + { + result = fileScopedNamespaceDeclarationSyntax.Name.ToString(); + return true; + } + + return TryGetNamespace(syntaxNode, out result); + } + catch + { + return false; + } + } +} diff --git a/src/FmgLib.MauiMarkup.Generator/Helpers/PropInfo.cs b/src/FmgLib.MauiMarkup.Generator/Helpers/PropInfo.cs new file mode 100644 index 0000000..c60f7fc --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/Helpers/PropInfo.cs @@ -0,0 +1,44 @@ +using Microsoft.CodeAnalysis; +using System; +using System.Linq; + +namespace FmgLib.MauiMarkup; + +public class PropInfo +{ + public string MainSymbolName { get; set; } + public IPropertySymbol PropertySymbol { get; set; } + public bool IsBindableProperty { get; set; } + public string BindablePropertyName { get; set; } + + public string propertyName; + public string propertyTypeName; + public string accessedWith; + public string camelCaseName; + public string valueAssignmentString; + public string dataTemplateAssignmentString; + + public void Build() + { + propertyName = PropertySymbol.Name.Split(new[] { "." }, StringSplitOptions.None).Last(); + propertyName = propertyName.Equals("class", StringComparison.Ordinal) ? "@class" : propertyName; + accessedWith = PropertySymbol.IsStatic ? MainSymbolName : "self"; + + if (IsBindableProperty && BindablePropertyName == null) + { + BindablePropertyName = $"{MainSymbolName}.{propertyName}"; + } + + camelCaseName = Helpers.ToCamelCase(propertyName); + propertyTypeName = PropertySymbol.Type.ToDisplayString(); + + valueAssignmentString = IsBindableProperty ? + $@"self.SetValue({BindablePropertyName}, {camelCaseName});" : + $"{accessedWith}.{propertyName} = {camelCaseName};"; + + dataTemplateAssignmentString = IsBindableProperty ? + $@"self.SetValue({BindablePropertyName}, new DataTemplate(loadTemplate));" : + $@"{accessedWith}.{propertyName} = new DataTemplate(loadTemplate);"; + + } +} diff --git a/src/FmgLib.MauiMarkup.Generator/SourceGenerator.cs b/src/FmgLib.MauiMarkup.Generator/SourceGenerator.cs new file mode 100644 index 0000000..d100a58 --- /dev/null +++ b/src/FmgLib.MauiMarkup.Generator/SourceGenerator.cs @@ -0,0 +1,159 @@ +using FmgLib.MauiMarkup.Generator.Extensions; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace FmgLib.MauiMarkup; + +[Generator] +public class SourceGenerator : ISourceGenerator +{ + public void Execute(GeneratorExecutionContext context) + { + foreach (var classToMarkup in ((MauiMarkupSyntaxReceiver)context.SyntaxReceiver.EnsureNotNull()).ClassesToMarkup) + { + INamedTypeSymbol generatorTypeSymbol = context.Compilation.GetTypeByMetadataName(classToMarkup).EnsureNotNull(); + + var mauiMarkupAttributes = generatorTypeSymbol + .GetAttributes() + .Where(_ => _.AttributeClass.EnsureNotNull().Name == "MauiMarkupAttribute" || _.AttributeClass.EnsureNotNull().Name == "MauiMarkup") + .ToList(); + + var mauiMarkupAttachedAttributes = generatorTypeSymbol + .GetAttributes() + .Where(_ => _.AttributeClass.EnsureNotNull().Name == "MauiMarkupAttachedPropAttribute" || _.AttributeClass.EnsureNotNull().Name == "MauiMarkupAttachedProp") + .ToList(); + + var classExts = new Dictionary(); + + foreach (var mauiMarkupAttribute in mauiMarkupAttributes) + { + if (mauiMarkupAttribute.ConstructorArguments.Length == 0) + { + throw new InvalidOperationException("Invalid MauiMarkupAttribute arguments"); + } + + var arrayArgument = mauiMarkupAttribute.ConstructorArguments[0]; + + if (arrayArgument.Kind != TypedConstantKind.Array) + { + throw new InvalidOperationException("MauiMarkupAttribute argument must be an array"); + } + + foreach (var item in arrayArgument.Values) + { + var typeMetadataName = ((ISymbol)item.Value.EnsureNotNull()).GetFullyQualifiedName(); + var typeToMauiMarkup = context.Compilation.GetTypeByMetadataName(typeMetadataName).EnsureNotNull(); + + var result = new ExtensionGenerator(context, typeToMauiMarkup).Build(); + + if (result.Item3) + { + if (classExts.ContainsKey(result.Item1)) + classExts[result.Item1]++; + else + classExts[result.Item1] = 0; + + context.AddSource(result.Item1 + $"{(classExts[result.Item1] == 0 ? "" : classExts[result.Item1].ToString())}.g.cs", result.Item2); + } + } + } + + classExts = new Dictionary(); + + foreach (var mauiMarkupAttachedAttribute in mauiMarkupAttachedAttributes) + { + if (mauiMarkupAttachedAttribute.ConstructorArguments.Length < 4) + { + throw new InvalidOperationException("Invalid MauiMarkupAttachedPropAttribute arguments"); + } + + AttachedModel attachedModel = new() + { + MainSymbol = context.Compilation.GetTypeByMetadataName(((ISymbol)mauiMarkupAttachedAttribute.ConstructorArguments[0].Value.EnsureNotNull()).GetFullyQualifiedName()).EnsureNotNull(), + ReturnTypeName = ((INamedTypeSymbol)mauiMarkupAttachedAttribute.ConstructorArguments[2].Value.EnsureNotNull()).GetFullyQualifiedName(), + DeclaringTypeName = ((INamedTypeSymbol)mauiMarkupAttachedAttribute.ConstructorArguments[3].Value.EnsureNotNull()).GetFullyQualifiedName(), + PropertyName = mauiMarkupAttachedAttribute.ConstructorArguments[1].Value.ToString().EnsureNotNull() + }; + + var result = new ExtensionGenerator(context, attachedModel).Build(); + + if (result.Item3) + { + if (classExts.ContainsKey(result.Item1)) + classExts[result.Item1]++; + else + classExts[result.Item1] = 0; + + context.AddSource(result.Item1 + $"{(classExts[result.Item1] == 0 ? "" : classExts[result.Item1].ToString())}.g.cs", result.Item2); + } + } + } + } + + public void Initialize(GeneratorInitializationContext context) + { + context.RegisterForPostInitialization((i) => + { + i.AddSource("MauiMarkupAttribute.g.cs", @"// +// +// + +using System; + +namespace FmgLib.MauiMarkup; + +[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] +internal class MauiMarkupAttribute : Attribute +{ + public MauiMarkupAttribute(params Type[] nativeControlTypes) { } +} + +"); + + i.AddSource("MauiMarkupAttachedPropAttribute.g.cs", @"// +// +// + +using System; + +namespace FmgLib.MauiMarkup; + +[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] +internal class MauiMarkupAttachedPropAttribute : Attribute +{ + public MauiMarkupAttachedPropAttribute(Type controlType, string propertyName, Type returnType, Type declaringType) { } +} + +"); + }); + + context.RegisterForSyntaxNotifications(() => new MauiMarkupSyntaxReceiver()); + } +} + + +class MauiMarkupSyntaxReceiver : ISyntaxReceiver +{ + public List ClassesToMarkup { get; } = new(); + + public void OnVisitSyntaxNode(SyntaxNode syntaxNode) + { + if (syntaxNode is ClassDeclarationSyntax cds) + { + var mauiMarkupAttribute = cds.AttributeLists + .Where(_ => _.Attributes.Any(attr => attr.Name is IdentifierNameSyntax nameSyntax && (nameSyntax.Identifier.Text == "MauiMarkup" || + nameSyntax.Identifier.Text == "MauiMarkupAttribute" || nameSyntax.Identifier.Text == "MauiMarkupAttachedProp" || + nameSyntax.Identifier.Text == "MauiMarkupAttachedPropAttribute"))) + .Select(_ => _.Attributes.First()) + .FirstOrDefault(); + + if (mauiMarkupAttribute != null) + { + ClassesToMarkup.Add(cds.GetFullyQualifiedName().EnsureNotNull()); + } + } + } +} diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/ColumnDefinitionBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/ColumnDefinitionBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/ColumnDefinitionBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/ColumnDefinitionBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/IPropertyBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/IPropertyBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/IPropertyBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/IPropertyBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/IPropertySettersBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/IPropertySettersBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/IPropertySettersBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/IPropertySettersBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertyBindingBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertyBindingBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertyBindingBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertyBindingBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertyDynamicResourcesBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertyDynamicResourcesBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertyDynamicResourcesBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertyDynamicResourcesBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertyIdiomBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertyIdiomBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertyIdiomBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertyIdiomBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertyPlatformBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertyPlatformBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertyPlatformBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertyPlatformBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersIdiomBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertySettersIdiomBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersIdiomBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertySettersIdiomBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersPlatformBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertySettersPlatformBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersPlatformBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertySettersPlatformBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersThemeBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertySettersThemeBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertySettersThemeBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertySettersThemeBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/PropertyThemeBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/PropertyThemeBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/PropertyThemeBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/PropertyThemeBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Builder/RowDefinitionBuilder.cs b/src/FmgLib.MauiMarkup/Core/Builder/RowDefinitionBuilder.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Builder/RowDefinitionBuilder.cs rename to src/FmgLib.MauiMarkup/Core/Builder/RowDefinitionBuilder.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/FuncContext.cs b/src/FmgLib.MauiMarkup/Core/Context/FuncContext.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/FuncContext.cs rename to src/FmgLib.MauiMarkup/Core/Context/FuncContext.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/FuncMultiContext.cs b/src/FmgLib.MauiMarkup/Core/Context/FuncMultiContext.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/FuncMultiContext.cs rename to src/FmgLib.MauiMarkup/Core/Context/FuncMultiContext.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/PropertyContext.cs b/src/FmgLib.MauiMarkup/Core/Context/PropertyContext.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/PropertyContext.cs rename to src/FmgLib.MauiMarkup/Core/Context/PropertyContext.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/PropertySettersContext.cs b/src/FmgLib.MauiMarkup/Core/Context/PropertySettersContext.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/PropertySettersContext.cs rename to src/FmgLib.MauiMarkup/Core/Context/PropertySettersContext.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/SetterContext.cs b/src/FmgLib.MauiMarkup/Core/Context/SetterContext.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/SetterContext.cs rename to src/FmgLib.MauiMarkup/Core/Context/SetterContext.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Context/Setters.cs b/src/FmgLib.MauiMarkup/Core/Context/Setters.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Context/Setters.cs rename to src/FmgLib.MauiMarkup/Core/Context/Setters.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Extensions/ColorExtension.cs b/src/FmgLib.MauiMarkup/Core/Extensions/ColorExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Extensions/ColorExtension.cs rename to src/FmgLib.MauiMarkup/Core/Extensions/ColorExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Extensions/IEnumerableExtension.cs b/src/FmgLib.MauiMarkup/Core/Extensions/IEnumerableExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Extensions/IEnumerableExtension.cs rename to src/FmgLib.MauiMarkup/Core/Extensions/IEnumerableExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Extensions/StyleExtension.cs b/src/FmgLib.MauiMarkup/Core/Extensions/StyleExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Extensions/StyleExtension.cs rename to src/FmgLib.MauiMarkup/Core/Extensions/StyleExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Extensions/VisualStateExtension.cs b/src/FmgLib.MauiMarkup/Core/Extensions/VisualStateExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Extensions/VisualStateExtension.cs rename to src/FmgLib.MauiMarkup/Core/Extensions/VisualStateExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Extensions/VisualStateGroupListExtension.cs b/src/FmgLib.MauiMarkup/Core/Extensions/VisualStateGroupListExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Extensions/VisualStateGroupListExtension.cs rename to src/FmgLib.MauiMarkup/Core/Extensions/VisualStateGroupListExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/INameScope.cs b/src/FmgLib.MauiMarkup/Core/Visuals/INameScope.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/INameScope.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/INameScope.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/NameScope.cs b/src/FmgLib.MauiMarkup/Core/Visuals/NameScope.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/NameScope.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/NameScope.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/Style.cs b/src/FmgLib.MauiMarkup/Core/Visuals/Style.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/Style.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/Style.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/Transformations.cs b/src/FmgLib.MauiMarkup/Core/Visuals/Transformations.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/Transformations.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/Transformations.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/VisualState.cs b/src/FmgLib.MauiMarkup/Core/Visuals/VisualState.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/VisualState.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/VisualState.cs diff --git a/libs/FmgLib.MauiMarkup/Core/Visuals/VisualStates.cs b/src/FmgLib.MauiMarkup/Core/Visuals/VisualStates.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Core/Visuals/VisualStates.cs rename to src/FmgLib.MauiMarkup/Core/Visuals/VisualStates.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ActivityIndicatorExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ActivityIndicatorExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ActivityIndicatorExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ActivityIndicatorExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/AdaptiveTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/AdaptiveTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/AdaptiveTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/AdaptiveTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/AppLinkEntryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/AppLinkEntryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/AppLinkEntryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/AppLinkEntryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ApplicationExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ApplicationExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ApplicationExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ApplicationExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ArcSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ArcSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ArcSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ArcSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BackButtonBehaviorExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BackButtonBehaviorExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BackButtonBehaviorExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BackButtonBehaviorExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BaseShellItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BaseShellItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BaseShellItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BaseShellItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BezierSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BezierSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BezierSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BezierSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BindableLayoutExtensions.cs b/src/FmgLib.MauiMarkup/Extensions/BindableLayoutExtensions.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BindableLayoutExtensions.cs rename to src/FmgLib.MauiMarkup/Extensions/BindableLayoutExtensions.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BindableObjectExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BindableObjectExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BindableObjectExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BindableObjectExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BindingBaseExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BindingBaseExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BindingBaseExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BindingBaseExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BindingConditionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BindingConditionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BindingConditionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BindingConditionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BindingExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BindingExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BindingExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BindingExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BorderExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BorderExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BorderExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BorderExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/BoxViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/BoxViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/BoxViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/BoxViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ButtonExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ButtonExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ButtonExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ButtonExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CarouselViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CarouselViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CarouselViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CarouselViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CheckBoxExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CheckBoxExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CheckBoxExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CheckBoxExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ClickGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ClickGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ClickGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ClickGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ColumnDefinitionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ColumnDefinitionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ColumnDefinitionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ColumnDefinitionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CompareStateTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CompareStateTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CompareStateTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CompareStateTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CompatibilityLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CompatibilityLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CompatibilityLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CompatibilityLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/CompositeTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/CompositeTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/CompositeTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/CompositeTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ContentPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ContentPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ContentPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ContentPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ContentPresenterExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ContentPresenterExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ContentPresenterExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ContentPresenterExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ContentViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ContentViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ContentViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ContentViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/DataTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/DataTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/DataTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/DataTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/DatePickerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/DatePickerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/DatePickerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/DatePickerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/DeviceStateTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/DeviceStateTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/DeviceStateTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/DeviceStateTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/DragGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/DragGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/DragGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/DragGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/DropGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/DropGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/DropGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/DropGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/EditorExtension.cs b/src/FmgLib.MauiMarkup/Extensions/EditorExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/EditorExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/EditorExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ElementExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ElementExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ElementExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ElementExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ElementTemplateExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ElementTemplateExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ElementTemplateExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ElementTemplateExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/EllipseGeometryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/EllipseGeometryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/EllipseGeometryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/EllipseGeometryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/EntryCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/EntryCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/EntryCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/EntryCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/EntryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/EntryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/EntryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/EntryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/EventTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/EventTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/EventTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/EventTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FileImageSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FileImageSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FileImageSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FileImageSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FlexLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FlexLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FlexLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FlexLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FlyoutPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FlyoutPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FlyoutPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FlyoutPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FontImageSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FontImageSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FontImageSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FontImageSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FormattedStringExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FormattedStringExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FormattedStringExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FormattedStringExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/FrameExtension.cs b/src/FmgLib.MauiMarkup/Extensions/FrameExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/FrameExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/FrameExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GeometryGroupExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GeometryGroupExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GeometryGroupExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GeometryGroupExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GestureElementExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GestureElementExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GestureElementExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GestureElementExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GradientBrushExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GradientBrushExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GradientBrushExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GradientBrushExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GradientStopExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GradientStopExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GradientStopExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GradientStopExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GraphicsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GraphicsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GraphicsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GraphicsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GridExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GridExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GridExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GridExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GridItemsLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GridItemsLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GridItemsLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GridItemsLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/GroupableItemsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/GroupableItemsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/GroupableItemsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/GroupableItemsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/HtmlWebViewSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/HtmlWebViewSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/HtmlWebViewSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/HtmlWebViewSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ImageButtonExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ImageButtonExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ImageButtonExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ImageButtonExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ImageCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ImageCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ImageCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ImageCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ImageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ImageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ImageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ImageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/IndicatorViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/IndicatorViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/IndicatorViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/IndicatorViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/InputViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/InputViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/InputViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/InputViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ItemsLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ItemsLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ItemsLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ItemsLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ItemsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ItemsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ItemsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ItemsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ItemsViewOfCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ItemsViewOfCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ItemsViewOfCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ItemsViewOfCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LabelExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LabelExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LabelExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LabelExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LineExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LineExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LineExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LineExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LineGeometryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LineGeometryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LineGeometryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LineGeometryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LineSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LineSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LineSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LineSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LinearGradientBrushExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LinearGradientBrushExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LinearGradientBrushExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LinearGradientBrushExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/LinearItemsLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/LinearItemsLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/LinearItemsLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/LinearItemsLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ListViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ListViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ListViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ListViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MatrixTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MatrixTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MatrixTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MatrixTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MenuBarExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MenuBarExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MenuBarExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MenuBarExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MenuBarItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MenuBarItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MenuBarItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MenuBarItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MenuItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MenuItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MenuItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MenuItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MultiPageOfPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MultiPageOfPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MultiPageOfPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MultiPageOfPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/MultiTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/MultiTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/MultiTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/MultiTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/NavigableElementExtension.cs b/src/FmgLib.MauiMarkup/Extensions/NavigableElementExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/NavigableElementExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/NavigableElementExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/NavigationPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/NavigationPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/NavigationPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/NavigationPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/OrientationStateTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/OrientationStateTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/OrientationStateTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/OrientationStateTriggerExtension.cs diff --git a/src/FmgLib.MauiMarkup/Extensions/PageExtension.NavigationPageProps.cs b/src/FmgLib.MauiMarkup/Extensions/PageExtension.NavigationPageProps.cs new file mode 100644 index 0000000..02d2972 --- /dev/null +++ b/src/FmgLib.MauiMarkup/Extensions/PageExtension.NavigationPageProps.cs @@ -0,0 +1,232 @@ +namespace FmgLib.MauiMarkup; + +public static partial class PageExtension +{ + public static T NavigationPageHasNavigationBar(this T self, + bool hasNavigationBar) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty, hasNavigationBar); + return self; + } + + public static T NavigationPageHasNavigationBar(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageHasNavigationBar(this SettersContext self, + bool hasNavigationBar) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty, Value = hasNavigationBar }); + return self; + } + + public static SettersContext NavigationPageHasNavigationBar(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty); + configure(context).Build(); + return self; + } + + public static T NavigationPageBackButtonTitle(this T self, + string backButtonTitle) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty, backButtonTitle); + return self; + } + + public static T NavigationPageBackButtonTitle(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageBackButtonTitle(this SettersContext self, + string backButtonTitle) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty, Value = backButtonTitle }); + return self; + } + + public static SettersContext NavigationPageBackButtonTitle(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty); + configure(context).Build(); + return self; + } + + public static T NavigationPageHasBackButton(this T self, + bool navigationPageHasBackButton) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.HasBackButtonProperty, navigationPageHasBackButton); + return self; + } + + public static T NavigationPageHasBackButton(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page + { + var navigationPageHasBackButton = configure(); + self.SetValue(Microsoft.Maui.Controls.NavigationPage.HasBackButtonProperty, navigationPageHasBackButton); + return self; + } + + public static T NavigationPageHasBackButton(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.HasBackButtonProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageHasBackButton(this SettersContext self, + bool navigationPageHasBackButton) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.HasBackButtonProperty, Value = navigationPageHasBackButton }); + return self; + } + + public static SettersContext NavigationPageHasBackButton(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.HasBackButtonProperty); + configure(context).Build(); + return self; + } + + public static T NavigationPageIconColor(this T self, + Microsoft.Maui.Graphics.Color navigationPageIconColor) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.IconColorProperty, navigationPageIconColor); + return self; + } + + public static T NavigationPageIconColor(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page + { + var navigationPageIconColor = configure(); + self.SetValue(Microsoft.Maui.Controls.NavigationPage.IconColorProperty, navigationPageIconColor); + return self; + } + + public static T NavigationPageIconColor(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.IconColorProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageIconColor(this SettersContext self, + Microsoft.Maui.Graphics.Color navigationPageIconColor) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.IconColorProperty, Value = navigationPageIconColor }); + return self; + } + + public static SettersContext NavigationPageIconColor(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.IconColorProperty); + configure(context).Build(); + return self; + } + + public static T NavigationPageTitleIconImageSource(this T self, + Microsoft.Maui.Controls.ImageSource navigationPageTitleIconImageSource) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty, navigationPageTitleIconImageSource); + return self; + } + + public static T NavigationPageTitleIconImageSource(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page + { + var navigationPageTitleIconImageSource = configure(); + self.SetValue(Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty, navigationPageTitleIconImageSource); + return self; + } + + public static T NavigationPageTitleIconImageSource(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageTitleIconImageSource(this SettersContext self, + Microsoft.Maui.Controls.ImageSource navigationPageTitleIconImageSource) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty, Value = navigationPageTitleIconImageSource }); + return self; + } + + public static SettersContext NavigationPageTitleIconImageSource(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty); + configure(context).Build(); + return self; + } + + public static T NavigationPageTitleView(this T self, + Microsoft.Maui.Controls.View navigationPageTitleView) + where T : Microsoft.Maui.Controls.Page + { + self.SetValue(Microsoft.Maui.Controls.NavigationPage.TitleViewProperty, navigationPageTitleView); + return self; + } + + public static T NavigationPageTitleView(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page + { + var navigationPageTitleView = configure(); + self.SetValue(Microsoft.Maui.Controls.NavigationPage.TitleViewProperty, navigationPageTitleView); + return self; + } + + public static T NavigationPageTitleView(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.TitleViewProperty); + configure(context).Build(); + return self; + } + + public static SettersContext NavigationPageTitleView(this SettersContext self, + Microsoft.Maui.Controls.View navigationPageTitleView) + where T : Microsoft.Maui.Controls.Page + { + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.TitleViewProperty, Value = navigationPageTitleView }); + return self; + } + + public static SettersContext NavigationPageTitleView(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page + { + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.TitleViewProperty); + configure(context).Build(); + return self; + } +} diff --git a/libs/FmgLib.MauiMarkup/Extensions/PageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PageExtension.ShellProps.cs similarity index 54% rename from libs/FmgLib.MauiMarkup/Extensions/PageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PageExtension.ShellProps.cs index 8a9364a..9cae174 100644 --- a/libs/FmgLib.MauiMarkup/Extensions/PageExtension.cs +++ b/src/FmgLib.MauiMarkup/Extensions/PageExtension.ShellProps.cs @@ -1,927 +1,953 @@ namespace FmgLib.MauiMarkup; - - public static partial class PageExtension { - public static T BackgroundImageSource(this T self, - ImageSource backgroundImageSource) + public static T ShellPresentationMode(this T self, + PresentationMode shellPresentationMode) where T : Page { - self.SetValue(Page.BackgroundImageSourceProperty, backgroundImageSource); + self.SetValue(Shell.PresentationModeProperty, shellPresentationMode); return self; } - public static T BackgroundImageSource(this T self, Func, IPropertyBuilder> configure) + public static T ShellPresentationMode(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Page.BackgroundImageSourceProperty); + var context = new PropertyContext(self, Shell.PresentationModeProperty); configure(context).Build(); return self; } - public static SettersContext BackgroundImageSource(this SettersContext self, - ImageSource backgroundImageSource) + public static SettersContext ShellPresentationMode(this SettersContext self, + PresentationMode shellPresentationMode) where T : Page { - self.XamlSetters.Add(new Setter { Property = Page.BackgroundImageSourceProperty, Value = backgroundImageSource }); + self.XamlSetters.Add(new Setter { Property = Shell.PresentationModeProperty, Value = shellPresentationMode }); return self; } - public static SettersContext BackgroundImageSource(this SettersContext self, Func, IPropertySettersBuilder> configure) + public static SettersContext ShellPresentationMode(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Page.BackgroundImageSourceProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.PresentationModeProperty); configure(context).Build(); return self; } - public static T IconImageSource(this T self, - ImageSource iconImageSource) + public static T ShellBackgroundColor(this T self, + Color shellBackgroundColor) where T : Page { - self.SetValue(Page.IconImageSourceProperty, iconImageSource); + self.SetValue(Shell.BackgroundColorProperty, shellBackgroundColor); return self; } - public static T IconImageSource(this T self, Func, IPropertyBuilder> configure) + public static T ShellBackgroundColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Page.IconImageSourceProperty); + var context = new PropertyContext(self, Shell.BackgroundColorProperty); configure(context).Build(); return self; } - public static SettersContext IconImageSource(this SettersContext self, - ImageSource iconImageSource) + public static SettersContext ShellBackgroundColor(this SettersContext self, + Color shellBackgroundColor) where T : Page { - self.XamlSetters.Add(new Setter { Property = Page.IconImageSourceProperty, Value = iconImageSource }); + self.XamlSetters.Add(new Setter { Property = Shell.BackgroundColorProperty, Value = shellBackgroundColor }); return self; } - public static SettersContext IconImageSource(this SettersContext self, Func, IPropertySettersBuilder> configure) + public static SettersContext ShellBackgroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Page.IconImageSourceProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.BackgroundColorProperty); configure(context).Build(); return self; } - public static T IsBusy(this T self, - bool isBusy) + public static T ShellForegroundColor(this T self, + Color shellForegroundColor) where T : Page { - self.SetValue(Page.IsBusyProperty, isBusy); + self.SetValue(Shell.ForegroundColorProperty, shellForegroundColor); return self; } - public static T IsBusy(this T self, Func, IPropertyBuilder> configure) + public static T ShellForegroundColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Page.IsBusyProperty); + var context = new PropertyContext(self, Shell.ForegroundColorProperty); configure(context).Build(); return self; } - public static SettersContext IsBusy(this SettersContext self, - bool isBusy) + public static SettersContext ShellForegroundColor(this SettersContext self, + Color shellForegroundColor) where T : Page { - self.XamlSetters.Add(new Setter { Property = Page.IsBusyProperty, Value = isBusy }); + self.XamlSetters.Add(new Setter { Property = Shell.ForegroundColorProperty, Value = shellForegroundColor }); return self; } - public static SettersContext IsBusy(this SettersContext self, Func, IPropertySettersBuilder> configure) + public static SettersContext ShellForegroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Page.IsBusyProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.ForegroundColorProperty); configure(context).Build(); return self; } - public static T Padding(this T self, double horizontalSize, double verticalSize) where T : Page + public static T ShellTitleColor(this T self, + Color shellTitleColor) + where T : Page + { + self.SetValue(Shell.TitleColorProperty, shellTitleColor); + return self; + } + + public static T ShellTitleColor(this T self, Func, IPropertyBuilder> configure) + where T : Page { - self.SetValue(Page.PaddingProperty, new Thickness(horizontalSize, verticalSize)); + var context = new PropertyContext(self, Shell.TitleColorProperty); + configure(context).Build(); return self; } - public static T Padding(this T self, double left, double top, double right, double bottom) where T : Page + public static SettersContext ShellTitleColor(this SettersContext self, + Color shellTitleColor) + where T : Page { - self.SetValue(Page.PaddingProperty, new Thickness(left, top, right, bottom)); + self.XamlSetters.Add(new Setter { Property = Shell.TitleColorProperty, Value = shellTitleColor }); return self; } - public static T Padding(this T self, object _ = null, double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0) where T : Page + public static SettersContext ShellTitleColor(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page { - self.SetValue(Page.PaddingProperty, new Thickness(left, top, right, bottom)); + var context = new PropertySettersContext(self.XamlSetters, Shell.TitleColorProperty); + configure(context).Build(); return self; } - public static T Padding(this T self, - Thickness padding) + public static T ShellDisabledColor(this T self, + Color shellDisabledColor) where T : Page { - self.SetValue(Page.PaddingProperty, padding); + self.SetValue(Shell.DisabledColorProperty, shellDisabledColor); return self; } - public static T Padding(this T self, Func, IPropertyBuilder> configure) + public static T ShellDisabledColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Page.PaddingProperty); + var context = new PropertyContext(self, Shell.DisabledColorProperty); configure(context).Build(); return self; } - public static SettersContext Padding(this SettersContext self, - Thickness padding) + public static SettersContext ShellDisabledColor(this SettersContext self, + Color shellDisabledColor) where T : Page { - self.XamlSetters.Add(new Setter { Property = Page.PaddingProperty, Value = padding }); + self.XamlSetters.Add(new Setter { Property = Shell.DisabledColorProperty, Value = shellDisabledColor }); return self; } - public static SettersContext Padding(this SettersContext self, Func, IPropertySettersBuilder> configure) + public static SettersContext ShellDisabledColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Page.PaddingProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.DisabledColorProperty); configure(context).Build(); return self; } - public static T Title(this T self, - string title) + public static T ShellUnselectedColor(this T self, + Color shellUnselectedColor) where T : Page { - self.SetValue(Page.TitleProperty, title); + self.SetValue(Shell.UnselectedColorProperty, shellUnselectedColor); return self; } - public static T Title(this T self, Func, IPropertyBuilder> configure) + public static T ShellUnselectedColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Page.TitleProperty); + var context = new PropertyContext(self, Shell.UnselectedColorProperty); configure(context).Build(); return self; } - public static SettersContext Title(this SettersContext self, - string title) + public static SettersContext ShellUnselectedColor(this SettersContext self, + Color shellUnselectedColor) where T : Page { - self.XamlSetters.Add(new Setter { Property = Page.TitleProperty, Value = title }); + self.XamlSetters.Add(new Setter { Property = Shell.UnselectedColorProperty, Value = shellUnselectedColor }); return self; } - public static SettersContext Title(this SettersContext self, Func, IPropertySettersBuilder> configure) + public static SettersContext ShellUnselectedColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Page.TitleProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.UnselectedColorProperty); configure(context).Build(); return self; } - public static T ToolbarItems(this T self, - IList toolbarItems) + public static T ShellNavBarHasShadow(this T self, + bool shellNavBarHasShadow) + where T : Page + { + self.SetValue(Shell.NavBarHasShadowProperty, shellNavBarHasShadow); + return self; + } + + public static T ShellNavBarHasShadow(this T self, Func, IPropertyBuilder> configure) where T : Page { - foreach (var item in toolbarItems) - self.ToolbarItems.Add(item); + var context = new PropertyContext(self, Shell.NavBarHasShadowProperty); + configure(context).Build(); return self; } - public static T ToolbarItems(this T self, - params ToolbarItem[] toolbarItems) + public static SettersContext ShellNavBarHasShadow(this SettersContext self, + bool shellNavBarHasShadow) where T : Page { - foreach (var item in toolbarItems) - self.ToolbarItems.Add(item); + self.XamlSetters.Add(new Setter { Property = Shell.NavBarHasShadowProperty, Value = shellNavBarHasShadow }); return self; } - public static T ToolbarItems(this T self, - Func configure) + public static SettersContext ShellNavBarHasShadow(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var toolbarItems = configure(); - foreach (var item in toolbarItems) - self.ToolbarItems.Add(item); + var context = new PropertySettersContext(self.XamlSetters, Shell.NavBarHasShadowProperty); + configure(context).Build(); return self; } - public static T MenuBarItems(this T self, - IList menuBarItems) + public static T ShellNavBarIsVisible(this T self, + bool shellNavBarIsVisible) where T : Page { - foreach (var item in menuBarItems) - self.MenuBarItems.Add(item); + self.SetValue(Shell.NavBarIsVisibleProperty, shellNavBarIsVisible); return self; } - public static T MenuBarItems(this T self, - params MenuBarItem[] menuBarItems) + public static T ShellNavBarIsVisible(this T self, Func, IPropertyBuilder> configure) where T : Page { - foreach (var item in menuBarItems) - self.MenuBarItems.Add(item); + var context = new PropertyContext(self, Shell.NavBarIsVisibleProperty); + configure(context).Build(); return self; } - public static T MenuBarItems(this T self, - Func configure) + public static SettersContext ShellNavBarIsVisible(this SettersContext self, + bool shellNavBarIsVisible) where T : Page { - var menuBarItems = configure(); - foreach (var item in menuBarItems) - self.MenuBarItems.Add(item); + self.XamlSetters.Add(new Setter { Property = Shell.NavBarIsVisibleProperty, Value = shellNavBarIsVisible }); return self; } - public static T ContainerArea(this T self, - Rect containerArea) + public static SettersContext ShellNavBarIsVisible(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - self.ContainerArea = containerArea; + var context = new PropertySettersContext(self.XamlSetters, Shell.NavBarIsVisibleProperty); + configure(context).Build(); return self; } - public static T IgnoresContainerArea(this T self, - bool ignoresContainerArea) + public static T ShellTabBarBackgroundColor(this T self, + Color shellTabBarBackgroundColor) where T : Page { - self.IgnoresContainerArea = ignoresContainerArea; + self.SetValue(Shell.TabBarBackgroundColorProperty, shellTabBarBackgroundColor); return self; } - public static T InternalChildren(this T self, - IList internalChildren) + public static T ShellTabBarBackgroundColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - foreach (var item in internalChildren) - self.InternalChildren.Add(item); + var context = new PropertyContext(self, Shell.TabBarBackgroundColorProperty); + configure(context).Build(); return self; } - public static T InternalChildren(this T self, - params Element[] internalChildren) + public static SettersContext ShellTabBarBackgroundColor(this SettersContext self, + Color shellTabBarBackgroundColor) where T : Page { - foreach (var item in internalChildren) - self.InternalChildren.Add(item); + self.XamlSetters.Add(new Setter { Property = Shell.TabBarBackgroundColorProperty, Value = shellTabBarBackgroundColor }); return self; } - public static T InternalChildren(this T self, - Func configure) + public static SettersContext ShellTabBarBackgroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var internalChildren = configure(); - foreach (var item in internalChildren) - self.InternalChildren.Add(item); + var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarBackgroundColorProperty); + configure(context).Build(); return self; } - public static T OnNavigatedTo(this T self, EventHandler handler) + public static T ShellTabBarForegroundColor(this T self, + Color shellTabBarForegroundColor) where T : Page { - self.NavigatedTo += handler; + self.SetValue(Shell.TabBarForegroundColorProperty, shellTabBarForegroundColor); return self; } - public static T OnNavigatedTo(this T self, Action action) + public static T ShellTabBarForegroundColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - self.NavigatedTo += (o, arg) => action(self); + var context = new PropertyContext(self, Shell.TabBarForegroundColorProperty); + configure(context).Build(); return self; } - public static T OnNavigatingFrom(this T self, EventHandler handler) + public static SettersContext ShellTabBarForegroundColor(this SettersContext self, + Color shellTabBarForegroundColor) where T : Page { - self.NavigatingFrom += handler; + self.XamlSetters.Add(new Setter { Property = Shell.TabBarForegroundColorProperty, Value = shellTabBarForegroundColor }); return self; } - public static T OnNavigatingFrom(this T self, Action action) + public static SettersContext ShellTabBarForegroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - self.NavigatingFrom += (o, arg) => action(self); + var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarForegroundColorProperty); + configure(context).Build(); return self; } - public static T OnNavigatedFrom(this T self, EventHandler handler) + public static T ShellTabBarTitleColor(this T self, + Color shellTabBarTitleColor) where T : Page { - self.NavigatedFrom += handler; + self.SetValue(Shell.TabBarTitleColorProperty, shellTabBarTitleColor); return self; } - public static T OnNavigatedFrom(this T self, Action action) + public static T ShellTabBarTitleColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - self.NavigatedFrom += (o, arg) => action(self); + var context = new PropertyContext(self, Shell.TabBarTitleColorProperty); + configure(context).Build(); return self; } - public static T OnLayoutChanged(this T self, EventHandler handler) + public static SettersContext ShellTabBarTitleColor(this SettersContext self, + Color shellTabBarTitleColor) where T : Page { - self.LayoutChanged += handler; + self.XamlSetters.Add(new Setter { Property = Shell.TabBarTitleColorProperty, Value = shellTabBarTitleColor }); return self; } - public static T OnLayoutChanged(this T self, Action action) + public static SettersContext ShellTabBarTitleColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - self.LayoutChanged += (o, arg) => action(self); + var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarTitleColorProperty); + configure(context).Build(); return self; } - public static T OnAppearing(this T self, EventHandler handler) + public static T ShellTabBarDisabledColor(this T self, + Color shellTabBarDisabledColor) where T : Page { - self.Appearing += handler; + self.SetValue(Shell.TabBarDisabledColorProperty, shellTabBarDisabledColor); return self; } - public static T OnAppearing(this T self, Action action) + public static T ShellTabBarDisabledColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - self.Appearing += (o, arg) => action(self); + var context = new PropertyContext(self, Shell.TabBarDisabledColorProperty); + configure(context).Build(); return self; } - public static T OnDisappearing(this T self, EventHandler handler) + public static SettersContext ShellTabBarDisabledColor(this SettersContext self, + Color shellTabBarDisabledColor) where T : Page { - self.Disappearing += handler; + self.XamlSetters.Add(new Setter { Property = Shell.TabBarDisabledColorProperty, Value = shellTabBarDisabledColor }); return self; } - public static T OnDisappearing(this T self, Action action) + public static SettersContext ShellTabBarDisabledColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - self.Disappearing += (o, arg) => action(self); + var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarDisabledColorProperty); + configure(context).Build(); return self; } - public static T ShellPresentationMode(this T self, - PresentationMode shellPresentationMode) + public static T ShellTabBarUnselectedColor(this T self, + Color shellTabBarUnselectedColor) where T : Page { - self.SetValue(Shell.PresentationModeProperty, shellPresentationMode); + self.SetValue(Shell.TabBarUnselectedColorProperty, shellTabBarUnselectedColor); return self; } - - public static T ShellPresentationMode(this T self, Func, IPropertyBuilder> configure) + + public static T ShellTabBarUnselectedColor(this T self, Func, IPropertyBuilder> configure) where T : Page { - var context = new PropertyContext(self, Shell.PresentationModeProperty); + var context = new PropertyContext(self, Shell.TabBarUnselectedColorProperty); configure(context).Build(); return self; } - - public static SettersContext ShellPresentationMode(this SettersContext self, - PresentationMode shellPresentationMode) + + public static SettersContext ShellTabBarUnselectedColor(this SettersContext self, + Color shellTabBarUnselectedColor) where T : Page { - self.XamlSetters.Add(new Setter { Property = Shell.PresentationModeProperty, Value = shellPresentationMode }); + self.XamlSetters.Add(new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = shellTabBarUnselectedColor }); return self; } - - public static SettersContext ShellPresentationMode(this SettersContext self, Func, IPropertySettersBuilder> configure) + + public static SettersContext ShellTabBarUnselectedColor(this SettersContext self, Func, IPropertySettersBuilder> configure) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.PresentationModeProperty); + var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarUnselectedColorProperty); configure(context).Build(); return self; } - - public static PresentationMode GetShellPresentationModeValue(this T self) - where T : Page + + public static T ShellBackButtonBehavior(this T self, + Microsoft.Maui.Controls.BackButtonBehavior shellBackButtonBehavior) + where T : Microsoft.Maui.Controls.Page { - return (PresentationMode)self.GetValue(Shell.PresentationModeProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, shellBackButtonBehavior); + return self; } - - public static T ShellBackgroundColor(this T self, - Color shellBackgroundColor) - where T : Page + + public static T ShellBackButtonBehavior(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.BackgroundColorProperty, shellBackgroundColor); + var shellBackButtonBehavior = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, shellBackButtonBehavior); return self; } - - public static T ShellBackgroundColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellBackButtonBehavior(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.BackgroundColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty); configure(context).Build(); return self; } - - public static SettersContext ShellBackgroundColor(this SettersContext self, - Color shellBackgroundColor) - where T : Page + + public static SettersContext ShellBackButtonBehavior(this SettersContext self, + Microsoft.Maui.Controls.BackButtonBehavior shellBackButtonBehavior) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.BackgroundColorProperty, Value = shellBackgroundColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, Value = shellBackButtonBehavior }); return self; } - - public static SettersContext ShellBackgroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellBackButtonBehavior(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.BackgroundColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty); configure(context).Build(); return self; } - - public static Color GetShellBackgroundColorValue(this T self) - where T : Page + + public static T ShellFlyoutBackdrop(this T self, + Microsoft.Maui.Controls.Brush shellFlyoutBackdrop) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.BackgroundColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutBackdropProperty, shellFlyoutBackdrop); + return self; } - - public static T ShellForegroundColor(this T self, - Color shellForegroundColor) - where T : Page + + public static T ShellFlyoutBackdrop(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.ForegroundColorProperty, shellForegroundColor); + var shellFlyoutBackdrop = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutBackdropProperty, shellFlyoutBackdrop); return self; } - - public static T ShellForegroundColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellFlyoutBackdrop(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.ForegroundColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.FlyoutBackdropProperty); configure(context).Build(); return self; } - - public static SettersContext ShellForegroundColor(this SettersContext self, - Color shellForegroundColor) - where T : Page + + public static SettersContext ShellFlyoutBackdrop(this SettersContext self, + Microsoft.Maui.Controls.Brush shellFlyoutBackdrop) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.ForegroundColorProperty, Value = shellForegroundColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.FlyoutBackdropProperty, Value = shellFlyoutBackdrop }); return self; } - - public static SettersContext ShellForegroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellFlyoutBackdrop(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.ForegroundColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.FlyoutBackdropProperty); configure(context).Build(); return self; } - - public static Color GetShellForegroundColorValue(this T self) - where T : Page + + public static T ShellTitleView(this T self, + Microsoft.Maui.Controls.View shellTitleView) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.ForegroundColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.TitleViewProperty, shellTitleView); + return self; } - - public static T ShellTitleColor(this T self, - Color shellTitleColor) - where T : Page + + public static T ShellTitleView(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.TitleColorProperty, shellTitleColor); + var shellTitleView = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.TitleViewProperty, shellTitleView); return self; } - - public static T ShellTitleColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellTitleView(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.TitleColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.TitleViewProperty); configure(context).Build(); return self; } - - public static SettersContext ShellTitleColor(this SettersContext self, - Color shellTitleColor) - where T : Page + + public static SettersContext ShellTitleView(this SettersContext self, + Microsoft.Maui.Controls.View shellTitleView) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.TitleColorProperty, Value = shellTitleColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.TitleViewProperty, Value = shellTitleView }); return self; } - - public static SettersContext ShellTitleColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellTitleView(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TitleColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.TitleViewProperty); configure(context).Build(); return self; } - - public static Color GetShellTitleColorValue(this T self) - where T : Page + + public static T ShellFlyoutBehavior(this T self, + Microsoft.Maui.FlyoutBehavior shellFlyoutBehavior) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.TitleColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutBehaviorProperty, shellFlyoutBehavior); + return self; } - - public static T ShellDisabledColor(this T self, - Color shellDisabledColor) - where T : Page + + public static T ShellFlyoutBehavior(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.DisabledColorProperty, shellDisabledColor); + var shellFlyoutBehavior = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutBehaviorProperty, shellFlyoutBehavior); return self; } - - public static T ShellDisabledColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellFlyoutBehavior(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.DisabledColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.FlyoutBehaviorProperty); configure(context).Build(); return self; } - - public static SettersContext ShellDisabledColor(this SettersContext self, - Color shellDisabledColor) - where T : Page + + public static SettersContext ShellFlyoutBehavior(this SettersContext self, + Microsoft.Maui.FlyoutBehavior shellFlyoutBehavior) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.DisabledColorProperty, Value = shellDisabledColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.FlyoutBehaviorProperty, Value = shellFlyoutBehavior }); return self; } - - public static SettersContext ShellDisabledColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellFlyoutBehavior(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.DisabledColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.FlyoutBehaviorProperty); configure(context).Build(); return self; } - - public static Color GetShellDisabledColorValue(this T self) - where T : Page + + public static T ShellFlyoutHeight(this T self, + double shellFlyoutHeight) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.DisabledColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutHeightProperty, shellFlyoutHeight); + return self; } - - public static T ShellUnselectedColor(this T self, - Color shellUnselectedColor) - where T : Page + + public static T ShellFlyoutHeight(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.UnselectedColorProperty, shellUnselectedColor); + var shellFlyoutHeight = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutHeightProperty, shellFlyoutHeight); return self; } - - public static T ShellUnselectedColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellFlyoutHeight(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.UnselectedColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.FlyoutHeightProperty); configure(context).Build(); return self; } - - public static SettersContext ShellUnselectedColor(this SettersContext self, - Color shellUnselectedColor) - where T : Page + + public static SettersContext ShellFlyoutHeight(this SettersContext self, + double shellFlyoutHeight) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.UnselectedColorProperty, Value = shellUnselectedColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.FlyoutHeightProperty, Value = shellFlyoutHeight }); return self; } - - public static SettersContext ShellUnselectedColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellFlyoutHeight(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.UnselectedColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.FlyoutHeightProperty); configure(context).Build(); return self; } - - public static Color GetShellUnselectedColorValue(this T self) - where T : Page + + public static T ShellFlyoutItemIsVisible(this T self, + bool shellFlyoutItemIsVisible) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.UnselectedColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutItemIsVisibleProperty, shellFlyoutItemIsVisible); + return self; } - - public static T ShellNavBarHasShadow(this T self, - bool shellNavBarHasShadow) - where T : Page + + public static T ShellFlyoutItemIsVisible(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.NavBarHasShadowProperty, shellNavBarHasShadow); + var shellFlyoutItemIsVisible = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutItemIsVisibleProperty, shellFlyoutItemIsVisible); return self; } - - public static T ShellNavBarHasShadow(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellFlyoutItemIsVisible(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.NavBarHasShadowProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.FlyoutItemIsVisibleProperty); configure(context).Build(); return self; } - - public static SettersContext ShellNavBarHasShadow(this SettersContext self, - bool shellNavBarHasShadow) - where T : Page + + public static SettersContext ShellFlyoutItemIsVisible(this SettersContext self, + bool shellFlyoutItemIsVisible) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.NavBarHasShadowProperty, Value = shellNavBarHasShadow }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.FlyoutItemIsVisibleProperty, Value = shellFlyoutItemIsVisible }); return self; } - - public static SettersContext ShellNavBarHasShadow(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellFlyoutItemIsVisible(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.NavBarHasShadowProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.FlyoutItemIsVisibleProperty); configure(context).Build(); return self; } - - public static bool GetShellNavBarHasShadowValue(this T self) - where T : Page + + public static T ShellFlyoutWidth(this T self, + double shellFlyoutWidth) + where T : Microsoft.Maui.Controls.Page { - return (bool)self.GetValue(Shell.NavBarHasShadowProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutWidthProperty, shellFlyoutWidth); + return self; } - - public static T ShellNavBarIsVisible(this T self, - bool shellNavBarIsVisible) - where T : Page + + public static T ShellFlyoutWidth(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.NavBarIsVisibleProperty, shellNavBarIsVisible); + var shellFlyoutWidth = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.FlyoutWidthProperty, shellFlyoutWidth); return self; } - - public static T ShellNavBarIsVisible(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellFlyoutWidth(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.NavBarIsVisibleProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.FlyoutWidthProperty); configure(context).Build(); return self; } - - public static SettersContext ShellNavBarIsVisible(this SettersContext self, - bool shellNavBarIsVisible) - where T : Page + + public static SettersContext ShellFlyoutWidth(this SettersContext self, + double shellFlyoutWidth) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.NavBarIsVisibleProperty, Value = shellNavBarIsVisible }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.FlyoutWidthProperty, Value = shellFlyoutWidth }); return self; } - - public static SettersContext ShellNavBarIsVisible(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellFlyoutWidth(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.NavBarIsVisibleProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.FlyoutWidthProperty); configure(context).Build(); return self; } - - public static bool GetShellNavBarIsVisibleValue(this T self) - where T : Page + + public static T ShellItemTemplate(this T self, + Microsoft.Maui.Controls.DataTemplate shellItemTemplate) + where T : Microsoft.Maui.Controls.Page { - return (bool)self.GetValue(Shell.NavBarIsVisibleProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.ItemTemplateProperty, shellItemTemplate); + return self; } - - public static T ShellTabBarBackgroundColor(this T self, - Color shellTabBarBackgroundColor) - where T : Page + + public static T ShellItemTemplate(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.TabBarBackgroundColorProperty, shellTabBarBackgroundColor); + var shellItemTemplate = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.ItemTemplateProperty, shellItemTemplate); return self; } - - public static T ShellTabBarBackgroundColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellItemTemplate(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.TabBarBackgroundColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.ItemTemplateProperty); configure(context).Build(); return self; } - - public static SettersContext ShellTabBarBackgroundColor(this SettersContext self, - Color shellTabBarBackgroundColor) - where T : Page + + public static SettersContext ShellItemTemplate(this SettersContext self, + Microsoft.Maui.Controls.DataTemplate shellItemTemplate) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.TabBarBackgroundColorProperty, Value = shellTabBarBackgroundColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.ItemTemplateProperty, Value = shellItemTemplate }); return self; } - - public static SettersContext ShellTabBarBackgroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellItemTemplate(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarBackgroundColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.ItemTemplateProperty); configure(context).Build(); return self; } - - public static Color GetShellTabBarBackgroundColorValue(this T self) - where T : Page + + public static T ShellMenuItemTemplate(this T self, + Microsoft.Maui.Controls.DataTemplate shellMenuItemTemplate) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.TabBarBackgroundColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.MenuItemTemplateProperty, shellMenuItemTemplate); + return self; } - - public static T ShellTabBarForegroundColor(this T self, - Color shellTabBarForegroundColor) - where T : Page + + public static T ShellMenuItemTemplate(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.TabBarForegroundColorProperty, shellTabBarForegroundColor); + var shellMenuItemTemplate = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.MenuItemTemplateProperty, shellMenuItemTemplate); return self; } - - public static T ShellTabBarForegroundColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellMenuItemTemplate(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.TabBarForegroundColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.MenuItemTemplateProperty); configure(context).Build(); return self; } - - public static SettersContext ShellTabBarForegroundColor(this SettersContext self, - Color shellTabBarForegroundColor) - where T : Page + + public static SettersContext ShellMenuItemTemplate(this SettersContext self, + Microsoft.Maui.Controls.DataTemplate shellMenuItemTemplate) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.TabBarForegroundColorProperty, Value = shellTabBarForegroundColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.MenuItemTemplateProperty, Value = shellMenuItemTemplate }); return self; } - - public static SettersContext ShellTabBarForegroundColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellMenuItemTemplate(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarForegroundColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.MenuItemTemplateProperty); configure(context).Build(); return self; } - - public static Color GetShellTabBarForegroundColorValue(this T self) - where T : Page + + public static T ShellSearchHandler(this T self, + Microsoft.Maui.Controls.SearchHandler shellSearchHandler) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.TabBarForegroundColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.SearchHandlerProperty, shellSearchHandler); + return self; } - - public static T ShellTabBarTitleColor(this T self, - Color shellTabBarTitleColor) - where T : Page + + public static T ShellSearchHandler(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.TabBarTitleColorProperty, shellTabBarTitleColor); + var shellSearchHandler = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.SearchHandlerProperty, shellSearchHandler); return self; } - - public static T ShellTabBarTitleColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellSearchHandler(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.TabBarTitleColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.SearchHandlerProperty); configure(context).Build(); return self; } - - public static SettersContext ShellTabBarTitleColor(this SettersContext self, - Color shellTabBarTitleColor) - where T : Page + + public static SettersContext ShellSearchHandler(this SettersContext self, + Microsoft.Maui.Controls.SearchHandler shellSearchHandler) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.TabBarTitleColorProperty, Value = shellTabBarTitleColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.SearchHandlerProperty, Value = shellSearchHandler }); return self; } - - public static SettersContext ShellTabBarTitleColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellSearchHandler(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarTitleColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.SearchHandlerProperty); configure(context).Build(); return self; } - - public static Color GetShellTabBarTitleColorValue(this T self) - where T : Page + + public static T ShellTabBarIsVisible(this T self, + bool shellTabBarIsVisible) + where T : Microsoft.Maui.Controls.Page { - return (Color)self.GetValue(Shell.TabBarTitleColorProperty); + self.SetValue(Microsoft.Maui.Controls.Shell.TabBarIsVisibleProperty, shellTabBarIsVisible); + return self; } - - public static T ShellTabBarDisabledColor(this T self, - Color shellTabBarDisabledColor) - where T : Page + + public static T ShellTabBarIsVisible(this T self, + Func configure) + where T : Microsoft.Maui.Controls.Page { - self.SetValue(Shell.TabBarDisabledColorProperty, shellTabBarDisabledColor); + var shellTabBarIsVisible = configure(); + self.SetValue(Microsoft.Maui.Controls.Shell.TabBarIsVisibleProperty, shellTabBarIsVisible); return self; } - - public static T ShellTabBarDisabledColor(this T self, Func, IPropertyBuilder> configure) - where T : Page + + public static T ShellTabBarIsVisible(this T self, Func, IPropertyBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertyContext(self, Shell.TabBarDisabledColorProperty); + var context = new PropertyContext(self, Microsoft.Maui.Controls.Shell.TabBarIsVisibleProperty); configure(context).Build(); return self; } - - public static SettersContext ShellTabBarDisabledColor(this SettersContext self, - Color shellTabBarDisabledColor) - where T : Page + + public static SettersContext ShellTabBarIsVisible(this SettersContext self, + bool shellTabBarIsVisible) + where T : Microsoft.Maui.Controls.Page { - self.XamlSetters.Add(new Setter { Property = Shell.TabBarDisabledColorProperty, Value = shellTabBarDisabledColor }); + self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.TabBarIsVisibleProperty, Value = shellTabBarIsVisible }); return self; } - - public static SettersContext ShellTabBarDisabledColor(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Page + + public static SettersContext ShellTabBarIsVisible(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Microsoft.Maui.Controls.Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarDisabledColorProperty); + var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.Shell.TabBarIsVisibleProperty); configure(context).Build(); return self; } - - public static Color GetShellTabBarDisabledColorValue(this T self) + + #region Get Methods + + public static Color GetShellTabBarUnselectedColorValue(this T self) where T : Page { - return (Color)self.GetValue(Shell.TabBarDisabledColorProperty); + return (Color)self.GetValue(Shell.TabBarUnselectedColorProperty); } - - public static T ShellTabBarUnselectedColor(this T self, - Color shellTabBarUnselectedColor) + + public static Color GetShellTabBarDisabledColorValue(this T self) where T : Page { - self.SetValue(Shell.TabBarUnselectedColorProperty, shellTabBarUnselectedColor); - return self; + return (Color)self.GetValue(Shell.TabBarDisabledColorProperty); } - - public static T ShellTabBarUnselectedColor(this T self, Func, IPropertyBuilder> configure) + + public static Color GetShellTabBarTitleColorValue(this T self) where T : Page { - var context = new PropertyContext(self, Shell.TabBarUnselectedColorProperty); - configure(context).Build(); - return self; + return (Color)self.GetValue(Shell.TabBarTitleColorProperty); } - - public static SettersContext ShellTabBarUnselectedColor(this SettersContext self, - Color shellTabBarUnselectedColor) + + public static Color GetShellTabBarForegroundColorValue(this T self) where T : Page { - self.XamlSetters.Add(new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = shellTabBarUnselectedColor }); - return self; + return (Color)self.GetValue(Shell.TabBarForegroundColorProperty); } - - public static SettersContext ShellTabBarUnselectedColor(this SettersContext self, Func, IPropertySettersBuilder> configure) + + public static Color GetShellTabBarBackgroundColorValue(this T self) where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Shell.TabBarUnselectedColorProperty); - configure(context).Build(); - return self; + return (Color)self.GetValue(Shell.TabBarBackgroundColorProperty); } - - public static Color GetShellTabBarUnselectedColorValue(this T self) + + public static bool GetShellNavBarIsVisibleValue(this T self) where T : Page { - return (Color)self.GetValue(Shell.TabBarUnselectedColorProperty); + return (bool)self.GetValue(Shell.NavBarIsVisibleProperty); } - - public static T NavigationPageHasNavigationBar(this T self, - bool hasNavigationBar) - where T : Microsoft.Maui.Controls.Page + public static bool GetShellNavBarHasShadowValue(this T self) + where T : Page { - self.SetValue(Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty, hasNavigationBar); - return self; + return (bool)self.GetValue(Shell.NavBarHasShadowProperty); } - public static T NavigationPageHasNavigationBar(this T self, Func, IPropertyBuilder> configure) - where T : Microsoft.Maui.Controls.Page + public static Color GetShellUnselectedColorValue(this T self) + where T : Page { - var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty); - configure(context).Build(); - return self; + return (Color)self.GetValue(Shell.UnselectedColorProperty); } - public static SettersContext NavigationPageHasNavigationBar(this SettersContext self, - bool hasNavigationBar) - where T : Microsoft.Maui.Controls.Page + public static Color GetShellDisabledColorValue(this T self) + where T : Page { - self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty, Value = hasNavigationBar }); - return self; + return (Color)self.GetValue(Shell.DisabledColorProperty); } - public static SettersContext NavigationPageHasNavigationBar(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Microsoft.Maui.Controls.Page + public static Color GetShellTitleColorValue(this T self) + where T : Page { - var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.HasNavigationBarProperty); - configure(context).Build(); - return self; + return (Color)self.GetValue(Shell.TitleColorProperty); } - public static T NavigationPageBackButtonTitle(this T self, - string backButtonTitle) - where T : Microsoft.Maui.Controls.Page + public static Color GetShellForegroundColorValue(this T self) + where T : Page { - self.SetValue(Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty, backButtonTitle); - return self; + return (Color)self.GetValue(Shell.ForegroundColorProperty); } - public static T NavigationPageBackButtonTitle(this T self, Func, IPropertyBuilder> configure) - where T : Microsoft.Maui.Controls.Page + public static Color GetShellBackgroundColorValue(this T self) + where T : Page { - var context = new PropertyContext(self, Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty); - configure(context).Build(); - return self; + return (Color)self.GetValue(Shell.BackgroundColorProperty); } - public static SettersContext NavigationPageBackButtonTitle(this SettersContext self, - string backButtonTitle) - where T : Microsoft.Maui.Controls.Page + public static PresentationMode GetShellPresentationModeValue(this T self) + where T : Page { - self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty, Value = backButtonTitle }); - return self; + return (PresentationMode)self.GetValue(Shell.PresentationModeProperty); } - public static SettersContext NavigationPageBackButtonTitle(this SettersContext self, Func, IPropertySettersBuilder> configure) - where T : Microsoft.Maui.Controls.Page - { - var context = new PropertySettersContext(self.XamlSetters, Microsoft.Maui.Controls.NavigationPage.BackButtonTitleProperty); - configure(context).Build(); - return self; - } + #endregion } diff --git a/src/FmgLib.MauiMarkup/Extensions/PageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PageExtension.cs new file mode 100644 index 0000000..1e006ba --- /dev/null +++ b/src/FmgLib.MauiMarkup/Extensions/PageExtension.cs @@ -0,0 +1,368 @@ +namespace FmgLib.MauiMarkup; + + + +public static partial class PageExtension +{ + public static T BackgroundImageSource(this T self, + ImageSource backgroundImageSource) + where T : Page + { + self.SetValue(Page.BackgroundImageSourceProperty, backgroundImageSource); + return self; + } + + public static T BackgroundImageSource(this T self, Func, IPropertyBuilder> configure) + where T : Page + { + var context = new PropertyContext(self, Page.BackgroundImageSourceProperty); + configure(context).Build(); + return self; + } + + public static SettersContext BackgroundImageSource(this SettersContext self, + ImageSource backgroundImageSource) + where T : Page + { + self.XamlSetters.Add(new Setter { Property = Page.BackgroundImageSourceProperty, Value = backgroundImageSource }); + return self; + } + + public static SettersContext BackgroundImageSource(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page + { + var context = new PropertySettersContext(self.XamlSetters, Page.BackgroundImageSourceProperty); + configure(context).Build(); + return self; + } + + public static T IconImageSource(this T self, + ImageSource iconImageSource) + where T : Page + { + self.SetValue(Page.IconImageSourceProperty, iconImageSource); + return self; + } + + public static T IconImageSource(this T self, Func, IPropertyBuilder> configure) + where T : Page + { + var context = new PropertyContext(self, Page.IconImageSourceProperty); + configure(context).Build(); + return self; + } + + public static SettersContext IconImageSource(this SettersContext self, + ImageSource iconImageSource) + where T : Page + { + self.XamlSetters.Add(new Setter { Property = Page.IconImageSourceProperty, Value = iconImageSource }); + return self; + } + + public static SettersContext IconImageSource(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page + { + var context = new PropertySettersContext(self.XamlSetters, Page.IconImageSourceProperty); + configure(context).Build(); + return self; + } + + public static T IsBusy(this T self, + bool isBusy) + where T : Page + { + self.SetValue(Page.IsBusyProperty, isBusy); + return self; + } + + public static T IsBusy(this T self, Func, IPropertyBuilder> configure) + where T : Page + { + var context = new PropertyContext(self, Page.IsBusyProperty); + configure(context).Build(); + return self; + } + + public static SettersContext IsBusy(this SettersContext self, + bool isBusy) + where T : Page + { + self.XamlSetters.Add(new Setter { Property = Page.IsBusyProperty, Value = isBusy }); + return self; + } + + public static SettersContext IsBusy(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page + { + var context = new PropertySettersContext(self.XamlSetters, Page.IsBusyProperty); + configure(context).Build(); + return self; + } + + public static T Padding(this T self, double horizontalSize, double verticalSize) where T : Page + { + self.SetValue(Page.PaddingProperty, new Thickness(horizontalSize, verticalSize)); + return self; + } + + public static T Padding(this T self, double left, double top, double right, double bottom) where T : Page + { + self.SetValue(Page.PaddingProperty, new Thickness(left, top, right, bottom)); + return self; + } + + public static T Padding(this T self, object _ = null, double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0) where T : Page + { + self.SetValue(Page.PaddingProperty, new Thickness(left, top, right, bottom)); + return self; + } + + public static T Padding(this T self, + Thickness padding) + where T : Page + { + self.SetValue(Page.PaddingProperty, padding); + return self; + } + + public static T Padding(this T self, Func, IPropertyBuilder> configure) + where T : Page + { + var context = new PropertyContext(self, Page.PaddingProperty); + configure(context).Build(); + return self; + } + + public static SettersContext Padding(this SettersContext self, + Thickness padding) + where T : Page + { + self.XamlSetters.Add(new Setter { Property = Page.PaddingProperty, Value = padding }); + return self; + } + + public static SettersContext Padding(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page + { + var context = new PropertySettersContext(self.XamlSetters, Page.PaddingProperty); + configure(context).Build(); + return self; + } + + public static T Title(this T self, + string title) + where T : Page + { + self.SetValue(Page.TitleProperty, title); + return self; + } + + public static T Title(this T self, Func, IPropertyBuilder> configure) + where T : Page + { + var context = new PropertyContext(self, Page.TitleProperty); + configure(context).Build(); + return self; + } + + public static SettersContext Title(this SettersContext self, + string title) + where T : Page + { + self.XamlSetters.Add(new Setter { Property = Page.TitleProperty, Value = title }); + return self; + } + + public static SettersContext Title(this SettersContext self, Func, IPropertySettersBuilder> configure) + where T : Page + { + var context = new PropertySettersContext(self.XamlSetters, Page.TitleProperty); + configure(context).Build(); + return self; + } + + public static T ToolbarItems(this T self, + IList toolbarItems) + where T : Page + { + foreach (var item in toolbarItems) + self.ToolbarItems.Add(item); + return self; + } + + public static T ToolbarItems(this T self, + params ToolbarItem[] toolbarItems) + where T : Page + { + foreach (var item in toolbarItems) + self.ToolbarItems.Add(item); + return self; + } + + public static T ToolbarItems(this T self, + Func configure) + where T : Page + { + var toolbarItems = configure(); + foreach (var item in toolbarItems) + self.ToolbarItems.Add(item); + return self; + } + + public static T MenuBarItems(this T self, + IList menuBarItems) + where T : Page + { + foreach (var item in menuBarItems) + self.MenuBarItems.Add(item); + return self; + } + + public static T MenuBarItems(this T self, + params MenuBarItem[] menuBarItems) + where T : Page + { + foreach (var item in menuBarItems) + self.MenuBarItems.Add(item); + return self; + } + + public static T MenuBarItems(this T self, + Func configure) + where T : Page + { + var menuBarItems = configure(); + foreach (var item in menuBarItems) + self.MenuBarItems.Add(item); + return self; + } + + public static T ContainerArea(this T self, + Rect containerArea) + where T : Page + { + self.ContainerArea = containerArea; + return self; + } + + public static T IgnoresContainerArea(this T self, + bool ignoresContainerArea) + where T : Page + { + self.IgnoresContainerArea = ignoresContainerArea; + return self; + } + + public static T InternalChildren(this T self, + IList internalChildren) + where T : Page + { + foreach (var item in internalChildren) + self.InternalChildren.Add(item); + return self; + } + + public static T InternalChildren(this T self, + params Element[] internalChildren) + where T : Page + { + foreach (var item in internalChildren) + self.InternalChildren.Add(item); + return self; + } + + public static T InternalChildren(this T self, + Func configure) + where T : Page + { + var internalChildren = configure(); + foreach (var item in internalChildren) + self.InternalChildren.Add(item); + return self; + } + + public static T OnNavigatedTo(this T self, EventHandler handler) + where T : Page + { + self.NavigatedTo += handler; + return self; + } + + public static T OnNavigatedTo(this T self, Action action) + where T : Page + { + self.NavigatedTo += (o, arg) => action(self); + return self; + } + + public static T OnNavigatingFrom(this T self, EventHandler handler) + where T : Page + { + self.NavigatingFrom += handler; + return self; + } + + public static T OnNavigatingFrom(this T self, Action action) + where T : Page + { + self.NavigatingFrom += (o, arg) => action(self); + return self; + } + + public static T OnNavigatedFrom(this T self, EventHandler handler) + where T : Page + { + self.NavigatedFrom += handler; + return self; + } + + public static T OnNavigatedFrom(this T self, Action action) + where T : Page + { + self.NavigatedFrom += (o, arg) => action(self); + return self; + } + + public static T OnLayoutChanged(this T self, EventHandler handler) + where T : Page + { + self.LayoutChanged += handler; + return self; + } + + public static T OnLayoutChanged(this T self, Action action) + where T : Page + { + self.LayoutChanged += (o, arg) => action(self); + return self; + } + + public static T OnAppearing(this T self, EventHandler handler) + where T : Page + { + self.Appearing += handler; + return self; + } + + public static T OnAppearing(this T self, Action action) + where T : Page + { + self.Appearing += (o, arg) => action(self); + return self; + } + + public static T OnDisappearing(this T self, EventHandler handler) + where T : Page + { + self.Disappearing += handler; + return self; + } + + public static T OnDisappearing(this T self, Action action) + where T : Page + { + self.Disappearing += (o, arg) => action(self); + return self; + } +} diff --git a/libs/FmgLib.MauiMarkup/Extensions/PanGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PanGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PanGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PanGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PathExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PathExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PathExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PathExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PathFigureExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PathFigureExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PathFigureExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PathFigureExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PathGeometryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PathGeometryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PathGeometryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PathGeometryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PickerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PickerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PickerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PickerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PinchGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PinchGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PinchGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PinchGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PointerGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PointerGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PointerGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PointerGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PolyBezierSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PolyBezierSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PolyBezierSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PolyBezierSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PolyLineSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PolyLineSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PolyLineSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PolyLineSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PolyQuadraticBezierSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PolyQuadraticBezierSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PolyQuadraticBezierSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PolyQuadraticBezierSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PolygonExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PolygonExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PolygonExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PolygonExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PolylineExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PolylineExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PolylineExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PolylineExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ProgressBarExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ProgressBarExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ProgressBarExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ProgressBarExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PropertyBindingBuilderExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PropertyBindingBuilderExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PropertyBindingBuilderExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PropertyBindingBuilderExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PropertyConditionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PropertyConditionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PropertyConditionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PropertyConditionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PropertyContextExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PropertyContextExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PropertyContextExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PropertyContextExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PropertySettersContextExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PropertySettersContextExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PropertySettersContextExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PropertySettersContextExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/PublicExtension.cs b/src/FmgLib.MauiMarkup/Extensions/PublicExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/PublicExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/PublicExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/QuadraticBezierSegmentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/QuadraticBezierSegmentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/QuadraticBezierSegmentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/QuadraticBezierSegmentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RadialGradientBrushExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RadialGradientBrushExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RadialGradientBrushExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RadialGradientBrushExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RadioButtonExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RadioButtonExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RadioButtonExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RadioButtonExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RectangleExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RectangleExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RectangleExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RectangleExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RectangleGeometryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RectangleGeometryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RectangleGeometryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RectangleGeometryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RefreshViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RefreshViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RefreshViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RefreshViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ReorderableItemsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ReorderableItemsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ReorderableItemsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ReorderableItemsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ResourceDictionaryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ResourceDictionaryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ResourceDictionaryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ResourceDictionaryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RotateTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RotateTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RotateTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RotateTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RoundRectangleExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RoundRectangleExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RoundRectangleExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RoundRectangleExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RoundRectangleGeometryExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RoundRectangleGeometryExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RoundRectangleGeometryExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RoundRectangleGeometryExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/RowDefinitionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/RowDefinitionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/RowDefinitionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/RowDefinitionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ScaleTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ScaleTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ScaleTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ScaleTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ScrollViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ScrollViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ScrollViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ScrollViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SearchBarExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SearchBarExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SearchBarExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SearchBarExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SearchHandlerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SearchHandlerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SearchHandlerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SearchHandlerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SelectableItemsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SelectableItemsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SelectableItemsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SelectableItemsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShadowExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShadowExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShadowExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShadowExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShapeExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShapeExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShapeExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShapeExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShapesLineExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShapesLineExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShapesLineExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShapesLineExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShapesPathFigureExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShapesPathFigureExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShapesPathFigureExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShapesPathFigureExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShellContentExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShellContentExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShellContentExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShellContentExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShellGroupItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShellGroupItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShellGroupItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShellGroupItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShellItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShellItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShellItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShellItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ShellSectionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ShellSectionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ShellSectionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ShellSectionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SkewTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SkewTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SkewTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SkewTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SliderExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SliderExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SliderExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SliderExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SolidColorBrushExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SolidColorBrushExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SolidColorBrushExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SolidColorBrushExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SpanExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SpanExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SpanExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SpanExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StackBaseExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StackBaseExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StackBaseExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StackBaseExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StackLayoutExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StackLayoutExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StackLayoutExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StackLayoutExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StateTriggerBaseExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StateTriggerBaseExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StateTriggerBaseExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StateTriggerBaseExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StateTriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StateTriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StateTriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StateTriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StepperExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StepperExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StepperExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StepperExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StreamImageSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StreamImageSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StreamImageSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StreamImageSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/StructuredItemsViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/StructuredItemsViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/StructuredItemsViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/StructuredItemsViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwipeGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwipeGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwipeGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwipeGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwipeItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwipeItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwipeItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwipeItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwipeItemViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwipeItemViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwipeItemViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwipeItemViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwipeItemsExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwipeItemsExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwipeItemsExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwipeItemsExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwipeViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwipeViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwipeViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwipeViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwitchCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwitchCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwitchCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwitchCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/SwitchExtension.cs b/src/FmgLib.MauiMarkup/Extensions/SwitchExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/SwitchExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/SwitchExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TabbedPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TabbedPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TabbedPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TabbedPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TableSectionBaseExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TableSectionBaseExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfTableSectionExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfTableSectionExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfTableSectionExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TableSectionBaseOfTableSectionExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TableViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TableViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TableViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TableViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TapGestureRecognizerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TapGestureRecognizerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TapGestureRecognizerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TapGestureRecognizerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TemplatedPageExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TemplatedPageExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TemplatedPageExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TemplatedPageExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TemplatedViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TemplatedViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TemplatedViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TemplatedViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TextCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TextCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TextCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TextCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TimePickerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TimePickerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TimePickerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TimePickerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ToolTipPropertiesExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ToolTipPropertiesExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ToolTipPropertiesExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ToolTipPropertiesExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ToolbarItemExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ToolbarItemExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ToolbarItemExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ToolbarItemExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TransformGroupExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TransformGroupExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TransformGroupExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TransformGroupExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TranslateTransformExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TranslateTransformExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TranslateTransformExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TranslateTransformExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TriggerBaseExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TriggerBaseExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TriggerBaseExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TriggerBaseExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/TriggerExtension.cs b/src/FmgLib.MauiMarkup/Extensions/TriggerExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/TriggerExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/TriggerExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/UriImageSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/UriImageSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/UriImageSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/UriImageSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/UrlWebViewSourceExtension.cs b/src/FmgLib.MauiMarkup/Extensions/UrlWebViewSourceExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/UrlWebViewSourceExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/UrlWebViewSourceExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ViewCellExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ViewCellExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ViewCellExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ViewCellExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/ViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/ViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/ViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/ViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/VisualElementExtension.cs b/src/FmgLib.MauiMarkup/Extensions/VisualElementExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/VisualElementExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/VisualElementExtension.cs diff --git a/src/FmgLib.MauiMarkup/Extensions/VisualStateGroupExtension.cs b/src/FmgLib.MauiMarkup/Extensions/VisualStateGroupExtension.cs new file mode 100644 index 0000000..4a8e38c --- /dev/null +++ b/src/FmgLib.MauiMarkup/Extensions/VisualStateGroupExtension.cs @@ -0,0 +1,60 @@ +namespace FmgLib.MauiMarkup; + +public static partial class VisualStateGroupExtension +{ + public static Microsoft.Maui.Controls.VisualStateGroup States(this Microsoft.Maui.Controls.VisualStateGroup self, + IList states) + { + foreach (var item in states) + self.States.Add(item); + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup States(this Microsoft.Maui.Controls.VisualStateGroup self, + params Microsoft.Maui.Controls.VisualState[] states) + { + foreach (var item in states) + self.States.Add(item); + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup States(this Microsoft.Maui.Controls.VisualStateGroup self, + Func configure) + { + var states = configure(); + foreach (var item in states) + self.States.Add(item); + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup Name(this Microsoft.Maui.Controls.VisualStateGroup self, + string name) + { + self.Name = name; + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup Name(this Microsoft.Maui.Controls.VisualStateGroup self, + Func configure) + { + var name = configure(); + self.Name = name; + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup TargetType(this Microsoft.Maui.Controls.VisualStateGroup self, + System.Type targetType) + { + self.TargetType = targetType; + return self; + } + + public static Microsoft.Maui.Controls.VisualStateGroup TargetType(this Microsoft.Maui.Controls.VisualStateGroup self, + Func configure) + { + var targetType = configure(); + self.TargetType = targetType; + return self; + } + +} diff --git a/libs/FmgLib.MauiMarkup/Extensions/WebViewExtension.cs b/src/FmgLib.MauiMarkup/Extensions/WebViewExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/WebViewExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/WebViewExtension.cs diff --git a/libs/FmgLib.MauiMarkup/Extensions/WindowExtension.cs b/src/FmgLib.MauiMarkup/Extensions/WindowExtension.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Extensions/WindowExtension.cs rename to src/FmgLib.MauiMarkup/Extensions/WindowExtension.cs diff --git a/libs/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj b/src/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj similarity index 86% rename from libs/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj rename to src/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj index f4b97ea..db2836a 100644 --- a/libs/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj +++ b/src/FmgLib.MauiMarkup/FmgLib.MauiMarkup.csproj @@ -11,7 +11,7 @@ FmgLib.MauiMarkup FmgLib.MauiMarkup with C# Markup classes and fluent helper methods FmgLib.MauiMarkup - 8.7.0 + 8.8.0 FmgYazılım Fmg Yazılım ©2024 @@ -28,7 +28,7 @@ - + @@ -36,4 +36,8 @@ + + + + diff --git a/libs/FmgLib.MauiMarkup/Handlers/FmgLibHotReloadHandler.cs b/src/FmgLib.MauiMarkup/Handlers/FmgLibHotReloadHandler.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Handlers/FmgLibHotReloadHandler.cs rename to src/FmgLib.MauiMarkup/Handlers/FmgLibHotReloadHandler.cs diff --git a/libs/FmgLib.MauiMarkup/Handlers/HotReloadExtensions.cs b/src/FmgLib.MauiMarkup/Handlers/HotReloadExtensions.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Handlers/HotReloadExtensions.cs rename to src/FmgLib.MauiMarkup/Handlers/HotReloadExtensions.cs diff --git a/libs/FmgLib.MauiMarkup/Handlers/IFmgLibHotReload.cs b/src/FmgLib.MauiMarkup/Handlers/IFmgLibHotReload.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Handlers/IFmgLibHotReload.cs rename to src/FmgLib.MauiMarkup/Handlers/IFmgLibHotReload.cs diff --git a/libs/FmgLib.MauiMarkup/LICENSE b/src/FmgLib.MauiMarkup/LICENSE similarity index 100% rename from libs/FmgLib.MauiMarkup/LICENSE rename to src/FmgLib.MauiMarkup/LICENSE diff --git a/libs/FmgLib.MauiMarkup/Pages/ContentPage.cs b/src/FmgLib.MauiMarkup/Pages/ContentPage.cs similarity index 100% rename from libs/FmgLib.MauiMarkup/Pages/ContentPage.cs rename to src/FmgLib.MauiMarkup/Pages/ContentPage.cs diff --git a/libs/FmgLib.MauiMarkup/README.md b/src/FmgLib.MauiMarkup/README.md similarity index 98% rename from libs/FmgLib.MauiMarkup/README.md rename to src/FmgLib.MauiMarkup/README.md index ad4f8c0..c703355 100644 --- a/libs/FmgLib.MauiMarkup/README.md +++ b/src/FmgLib.MauiMarkup/README.md @@ -115,7 +115,6 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif | Maui bağlı özelliği | FmgLib.MauiMarkup metodu | |-|-| - |`Shell.ItemTemplate`|`ShellItemTemplate()`| |`FlyoutBase.ContextFlyout`|`ContextFlyout()`| |`Grid.Column`|`Column()`| |`Grid.Row`|`Row()`| @@ -131,7 +130,7 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif |`BindableLayout.ItemTemplate`|`BindableLayoutItemTemplate()`| |`BindableLayout.TemplateSelector`|`BindableItemTemplateSelector()`| |`Shell.PresentationMode`|`ShellPresentationMode()`| - |`ShellBackgroundColor`|`ShellBackgroundColor()`| + |`Shell.BackgroundColor`|`ShellBackgroundColor()`| |`Shell.ForegroundColor`|`ShellForegroundColor()`| |`Shell.TitleColor`|`ShellTitleColor()`| |`Shell.DisabledColor`|`ShellDisabledColor()`| @@ -139,8 +138,27 @@ This would set the `AbsoluteLayout.LayoutBounds` attached property to the specif |`Shell.NavBarHasShadow`|`ShellNavBarHasShadow()`| |`Shell.NavBarIsVisible`|`ShellNavBarIsVisible()`| |`Shell.TitleView`|`ShellTitleView()`| + |`Shell.TabBarBackgroundColor`|`ShellTabBarBackgroundColor()`| + |`Shell.TabBarForegroundColor`|`ShellTabBarForegroundColor()`| + |`Shell.TabBarTitleColor`|`ShellTabBarTitleColor()`| + |`Shell.TabBarDisabledColor`|`ShellTabBarDisabledColor()`| + |`Shell.TabBarUnselectedColor`|`ShellTabBarUnselectedColor()`| + |`Shell.TabBarIsVisible`|`ShellTabBarIsVisible()`| + |`Shell.FlyoutBackdrop`|`ShellFlyoutBackdrop()`| + |`Shell.FlyoutBehavior`|`ShellFlyoutBehavior()`| + |`Shell.FlyoutHeight`|`ShellFlyoutHeight()`| + |`Shell.FlyoutWidth`|`ShellFlyoutWidth()`| + |`Shell.FlyoutItemIsVisible`|`ShellFlyoutItemIsVisible()`| + |`Shell.BackButtonBehavior`|`ShellBackButtonBehavior()`| + |`Shell.ItemTemplate`|`ShellItemTemplate()`| + |`Shell.MenuItemTemplate`|`ShellMenuItemTemplate()`| + |`Shell.SearchHandler`|`ShellSearchHandler()`| |`NavigationPage.HasNavigationBar`|`NavigationPageHasNavigationBar()`| |`NavigationPage.BackButtonTitle`|`NavigationPageBackButtonTitle()`| + |`NavigationPage.HasBackButton`|`NavigationPageHasBackButton()`| + |`NavigationPage.IconColor`|`NavigationPageIconColor()`| + |`NavigationPage.TitleIconImageSource`|`NavigationPageTitleIconImageSource()`| + |`NavigationPage.TitleView`|`NavigationPageTitleView()`| |`SemanticProperties.Hint`|`SemanticHint()`| |`SemanticProperties.Description`|`SemanticDescription()`| |`SemanticProperties.HeadingLevel`|`SemanticHeadingLevel()`| diff --git a/libs/FmgLib.MauiMarkup/nuget.png b/src/FmgLib.MauiMarkup/nuget.png similarity index 100% rename from libs/FmgLib.MauiMarkup/nuget.png rename to src/FmgLib.MauiMarkup/nuget.png diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.Template.csproj b/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.Template.csproj new file mode 100644 index 0000000..b0fb82f --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.Template.csproj @@ -0,0 +1,46 @@ + + + + + + FmgLib.MauiMarkup.Template + 3.3.1 + FmgLib.MauiMarkup.Template + FmgYazılım + C# Markup (No XAML) templates for .NET MAUI application with Hotreload process. + MAUI,Android,iOS,macOS,Windows,MacCatalyst,Tizen,fmglib,mauimarkup,toolkit,mvvm,extension,template,app,mobile,desktop,xamarin,xamarin.forms,net,maui,netmaui,markup,csharpformarkup,csharp,csharpmarkup,xaml,mobile,android,ios,macos,windows,noxaml,fmglib + https://fmgyazilim.com/ + + Template + net8.0 + true + false + content + $(NoWarn);NU5128 + true + README.md + nuget.png + LICENSE + + + + false + True + + + + + + + + + + + + + + + + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.TemplateApp.sln b/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.TemplateApp.sln new file mode 100644 index 0000000..caa3bae --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/FmgLib.MauiMarkup.TemplateApp.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup.Template", "FmgLib.MauiMarkup.Template.csproj", "{EA409E2D-9390-43ED-8C43-BB585D6A3900}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{AE82BA15-2CEB-410A-80D5-031D4E2657DD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FmgLib.MauiMarkup.App", "content\FmgLib.MauiMarkup.App\FmgLib.MauiMarkup.App.csproj", "{82ED8918-F73B-4270-8B4E-360999EE9EDB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FmgLib.MauiMarkup.ContentPage", "FmgLib.MauiMarkup.ContentPage", "{087B98B8-967D-42ED-ADF3-DF4FA1F35C83}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA409E2D-9390-43ED-8C43-BB585D6A3900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA409E2D-9390-43ED-8C43-BB585D6A3900}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA409E2D-9390-43ED-8C43-BB585D6A3900}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA409E2D-9390-43ED-8C43-BB585D6A3900}.Release|Any CPU.Build.0 = Release|Any CPU + {82ED8918-F73B-4270-8B4E-360999EE9EDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82ED8918-F73B-4270-8B4E-360999EE9EDB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82ED8918-F73B-4270-8B4E-360999EE9EDB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82ED8918-F73B-4270-8B4E-360999EE9EDB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {82ED8918-F73B-4270-8B4E-360999EE9EDB} = {AE82BA15-2CEB-410A-80D5-031D4E2657DD} + {087B98B8-967D-42ED-ADF3-DF4FA1F35C83} = {AE82BA15-2CEB-410A-80D5-031D4E2657DD} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DDAE1BF9-11D3-41C8-A50E-C9DB9F20357C} + EndGlobalSection +EndGlobal diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/LICENSE b/templates/FmgLib.MauiMarkup.TemplateApp/LICENSE new file mode 100644 index 0000000..0373f6c --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Mustafa Gönültaş + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "FmgLib.MauiMarkup.Template"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/README.md b/templates/FmgLib.MauiMarkup.TemplateApp/README.md new file mode 100644 index 0000000..678ce85 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/README.md @@ -0,0 +1,15 @@ +## Creating a new FmgLib.MauiMarkup project from CLI + +FmgLib provides a project template to start a new project with FmgLib.MauiMarkup. + +**Install latest templates from NuGet:** +```bash +dotnet new install FmgLib.MauiMarkup.Template +``` + + +**Create a new project:** + +```bash +dotnet new fmglib-mauimarkup-app -o my-new-project +``` \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/icon.ico b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/icon.ico new file mode 100644 index 0000000..1d623e3 Binary files /dev/null and b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/icon.ico differ diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/ide.host.json b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/ide.host.json new file mode 100644 index 0000000..23be918 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/ide.host.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json.schemastore.org/vs-2017.3.host", + "icon": "icon.ico" +} \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/template.json b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/template.json new file mode 100644 index 0000000..41143ac --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/.template.config/template.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "FmgLib", + "classifications": [ "MAUI", "Android", "iOS", "macOS", "Windows", "Mac Catalyst", "Tizen" ], + "identity": "FmgLibMauiMarkupApp", + "name": ".NET MAUI Markup App", + "shortName": "fmglib-mauimarkup-app", + "description": "C# Markup (No XAML) template for .NET MAUI application with Hotreload process.", + "tags": { + "language": "C#", + "type": "project" + }, + "groupIdentity": "FmgLibMauiMarkupApp", + "sourceName": "FmgLib.MauiMarkup.App", + "preferNameDirectory": true, + "guids": [ + "e0cd07a0-669f-49cf-bda8-9f77d0c5ca77" + ] +} \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/App.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/App.cs new file mode 100644 index 0000000..0a6e415 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/App.cs @@ -0,0 +1,11 @@ +namespace FmgLib.MauiMarkup.App; + +public partial class App : Application +{ + public App() + { + this + .Resources(AppStyles.Default) + .MainPage(new AppShell()); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/AppShell.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/AppShell.cs new file mode 100644 index 0000000..f6fbd6e --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/AppShell.cs @@ -0,0 +1,16 @@ +namespace FmgLib.MauiMarkup.App; + +public partial class AppShell : Shell +{ + public AppShell() + { + this + .FlyoutBehavior(FlyoutBehavior.Disabled) + .Items( + new ShellContent() + .Title("Home") + .ContentTemplate(() => new MainPage()) + .Route(nameof(MainPage)) + ); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/FmgLib.MauiMarkup.App.csproj b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/FmgLib.MauiMarkup.App.csproj new file mode 100644 index 0000000..95eb6ed --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/FmgLib.MauiMarkup.App.csproj @@ -0,0 +1,76 @@ + + + + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + + + + + + + Exe + FmgLib.MauiMarkup.App + true + true + enable + enable + + + FmgLib.MauiMarkup.App + + + com.companyname.fmglib.mauimarkup.app + e0cd07a0-669f-49cf-bda8-9f77d0c5ca77 + + + 1.0 + 1 + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Imports.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Imports.cs new file mode 100644 index 0000000..67f845e --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Imports.cs @@ -0,0 +1,18 @@ +global using FmgLib.MauiMarkup.App; + +// Markup FmgLib +global using FmgLib.MauiMarkup; +global using FmgLib.MauiMarkup.Core; + +// Static +global using static Microsoft.Maui.Graphics.Colors; +global using static Microsoft.Maui.Controls.FontAttributes; +global using static Microsoft.Maui.Controls.LayoutAlignment; +global using static Microsoft.Maui.ScrollBarVisibility; +global using static Microsoft.Maui.SwipeMode; +global using static Microsoft.Maui.SwipeDirection; +global using static Microsoft.Maui.TextType; +global using static Microsoft.Maui.Visibility; + + +global using MC = Microsoft.Maui.Controls; diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MainPage.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MainPage.cs new file mode 100644 index 0000000..e7f9f04 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MainPage.cs @@ -0,0 +1,84 @@ +using System.Reflection; + +namespace FmgLib.MauiMarkup.App; + +public partial class MainPage : ContentPage, IFmgLibHotReload +{ + public MainPage() + { + this.InitializeHotReload(); + } + + public void Build() + { + var version = typeof(MauiApp).Assembly.GetCustomAttribute()?.InformationalVersion; + + this + .Content( + new ScrollView() + .Content( + new Grid() + .RowDefinitions(e => e.Star(90).Star(10)) + .Children( + new StackLayout() + .Spacing(25) + .Children( + new Label() + .Text("Hello, World!") + .FontSize(32) + .CenterHorizontal() + .SemanticHeadingLevel(SemanticHeadingLevel.Level1), + + new Label() + .Text("Welcome to FmgLib .NET MAUI Markup App") + .FontSize(18) + .CenterHorizontal() + .SemanticDescription("Welcome to dot net Multi platform App U I") + .SemanticHeadingLevel(SemanticHeadingLevel.Level1), + + new Label() + .Text("Current count: 0") + .FontSize(18) + .FontAttributes(Bold) + .CenterHorizontal() + .Assign(out CounterLabel), + + new Button() + .Text("Click me") + .CenterHorizontal() + .OnClicked(OnCounterClicked) + .SemanticHint("Counts the number of times you click"), + + new Image() + .Source("dotnet_bot.png") + .SizeRequest(250,310) + .CenterHorizontal() + .SemanticDescription("Cute dot net bot waving hi to you!") + ), + + new Grid() + .BackgroundColor(AppColors.Primary) + .Row(1) + .Children( + new Label() + .Text($"dotNet version: {version}") + .TextColor(White) + .Center() + ) + ) + ) + ); + } + + private int _count = 0; + private Label CounterLabel; + + + private void OnCounterClicked(object? sender, EventArgs e) + { + _count++; + CounterLabel.Text = $"Current count: {_count}"; + + SemanticScreenReader.Announce(CounterLabel.Text); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MauiProgram.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MauiProgram.cs new file mode 100644 index 0000000..722ca3e --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/MauiProgram.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.Logging; + +namespace FmgLib.MauiMarkup.App; + +public static class MauiProgram +{ + public static MauiApp CreateMauiApp() + { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); + + builder.Logging.AddDebug(); + + builder.Services + .AddSingleton() + .AddSingleton() + .AddScoped(); + + return builder.Build(); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/AndroidManifest.xml b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/AndroidManifest.xml new file mode 100644 index 0000000..e9937ad --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainActivity.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainActivity.cs new file mode 100644 index 0000000..2a49ce8 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainActivity.cs @@ -0,0 +1,10 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; + +namespace FmgLib.MauiMarkup.App; + +[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] +public class MainActivity : MauiAppCompatActivity +{ +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainApplication.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainApplication.cs new file mode 100644 index 0000000..1b3a78e --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/MainApplication.cs @@ -0,0 +1,15 @@ +using Android.App; +using Android.Runtime; + +namespace FmgLib.MauiMarkup.App; + +[Application] +public class MainApplication : MauiApplication +{ + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/Resources/values/colors.xml b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 0000000..c04d749 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/AppDelegate.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 0000000..8a8d076 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,9 @@ +using Foundation; + +namespace FmgLib.MauiMarkup.App; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Entitlements.plist b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 0000000..de4adc9 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Info.plist b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Info.plist new file mode 100644 index 0000000..7268977 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + UIDeviceFamily + + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Program.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Program.cs new file mode 100644 index 0000000..dbf00aa --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,15 @@ +using ObjCRuntime; +using UIKit; + +namespace FmgLib.MauiMarkup.App; + +public class Program +{ + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/Main.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/Main.cs new file mode 100644 index 0000000..35edfa4 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/Main.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Maui; +using Microsoft.Maui.Hosting; + +namespace FmgLib.MauiMarkup.App; + +class Program : MauiApplication +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/tizen-manifest.xml b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 0000000..a347ad1 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + maui-appicon-placeholder + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml new file mode 100644 index 0000000..472d209 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml.cs new file mode 100644 index 0000000..ac8383f --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/App.xaml.cs @@ -0,0 +1,24 @@ +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace FmgLib.MauiMarkup.App.WinUI; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : MauiWinUIApplication +{ + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/Package.appxmanifest b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/Package.appxmanifest new file mode 100644 index 0000000..47820b7 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,46 @@ + + + + + + + + + $placeholder$ + User Name + $placeholder$.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/app.manifest b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/app.manifest new file mode 100644 index 0000000..9ca16ee --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/AppDelegate.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/AppDelegate.cs new file mode 100644 index 0000000..8a8d076 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,9 @@ +using Foundation; + +namespace FmgLib.MauiMarkup.App; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Info.plist b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Info.plist new file mode 100644 index 0000000..0004a4f --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Info.plist @@ -0,0 +1,32 @@ + + + + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Program.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Program.cs new file mode 100644 index 0000000..dbf00aa --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Platforms/iOS/Program.cs @@ -0,0 +1,15 @@ +using ObjCRuntime; +using UIKit; + +namespace FmgLib.MauiMarkup.App; + +public class Program +{ + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Properties/launchSettings.json b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Properties/launchSettings.json new file mode 100644 index 0000000..edf8aad --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Windows Machine": { + "commandName": "MsixPackage", + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appicon.svg b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appicon.svg new file mode 100644 index 0000000..9d63b65 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appiconfg.svg b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appiconfg.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/AppIcon/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Regular.ttf b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..2d1edf0 Binary files /dev/null and b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Regular.ttf differ diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Semibold.ttf b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 0000000..fe13d06 Binary files /dev/null and b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Fonts/OpenSans-Semibold.ttf differ diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Images/dotnet_bot.png b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Images/dotnet_bot.png new file mode 100644 index 0000000..f93ce02 Binary files /dev/null and b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Images/dotnet_bot.png differ diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Raw/AboutAssets.txt b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Raw/AboutAssets.txt new file mode 100644 index 0000000..15d6244 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Raw/AboutAssets.txt @@ -0,0 +1,15 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories). Deployment of the asset to your application +is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. + + + +These files will be deployed with you package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Splash/splash.svg b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Splash/splash.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Splash/splash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppColors.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppColors.cs new file mode 100644 index 0000000..3664ad5 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppColors.cs @@ -0,0 +1,33 @@ +namespace FmgLib.MauiMarkup.App; + +public class AppColors +{ + public static readonly Color Primary = "#512BD4".ToColor(); + public static readonly Color Secondary = "#DFD8F7".ToColor(); + public static readonly Color Tertiary = "#2B0B98".ToColor(); + + public static readonly Color Gray100 = "#E1E1E1".ToColor(); + public static readonly Color Gray200 = "#C8C8C8".ToColor(); + public static readonly Color Gray300 = "#ACACAC".ToColor(); + public static readonly Color Gray400 = "#919191".ToColor(); + public static readonly Color Gray500 = "#6E6E6E".ToColor(); + public static readonly Color Gray600 = "#404040".ToColor(); + public static readonly Color Gray900 = "#212121".ToColor(); + public static readonly Color Gray950 = "#141414".ToColor(); + + + public static readonly SolidColorBrush PrimaryBrush = new(Primary); + public static readonly SolidColorBrush SecondaryBrush = new(Secondary); + public static readonly SolidColorBrush TertiaryBrush = new(Tertiary); + public static readonly SolidColorBrush WhiteBrush = new(White); + public static readonly SolidColorBrush BlackBrush = new(Black); + + public static readonly SolidColorBrush Gray100Brush = new(Gray100); + public static readonly SolidColorBrush Gray200Brush = new(Gray200); + public static readonly SolidColorBrush Gray300Brush = new(Gray300); + public static readonly SolidColorBrush Gray400Brush = new(Gray400); + public static readonly SolidColorBrush Gray500Brush = new(Gray500); + public static readonly SolidColorBrush Gray600Brush = new(Gray600); + public static readonly SolidColorBrush Gray900Brush = new(Gray900); + public static readonly SolidColorBrush Gray950Brush = new(Gray950); +} diff --git a/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppStyles.cs b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppStyles.cs new file mode 100644 index 0000000..4bbb962 --- /dev/null +++ b/templates/FmgLib.MauiMarkup.TemplateApp/content/FmgLib.MauiMarkup.App/Resources/Styles/AppStyles.cs @@ -0,0 +1,332 @@ +using Microsoft.Maui.Controls.Shapes; + +namespace FmgLib.MauiMarkup.App; + +public class AppStyles +{ + public static ResourceDictionary Default => new ResourceDictionary { + + // "ActivityIndicator" + + new Style(e => e + .Color(e => e.OnLight(AppColors.Primary).OnDark(White))), + + // "IndicatorView" + + new Style(e => e + .IndicatorColor(e => e.OnLight(AppColors.Gray200).OnDark(AppColors.Gray500)) + .SelectedIndicatorColor(e => e.OnLight(AppColors.Gray950).OnDark(AppColors.Gray100))), + + // "Border" + + new Style(e => e + .Stroke(e => e.OnLight(AppColors.Gray200).OnDark(AppColors.Gray500)) + .StrokeShape(new Rectangle()) + .StrokeThickness(1)), + + // "BoxView" + + new Style(e => e + .Color(e => e.OnLight(AppColors.Gray950).OnDark(AppColors.Gray200))), + + + // "Button" + + new Style