Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/adaptiveproperties #129

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ To install .NET MAUI Control Gallery on your device or emulator/simulator:
1. Clone or download this repository
2. Open the solution file (.sln) in Visual Studio 2022 or later
3. Select your target platform and device/emulator/simulator
4. Build and run the app
4. Create the appsettings.Development.json file and this file will not contain any private key
5. Build and run the app

We will publish our application on all platforms soon enough. Stay tuned!!!

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace MAUIsland.Gallery.Community;
class AdaptivePropertiesControlInfo : IControlInfo
{
public string ControlName => "AdaptiveProperties";
public string ControlRoute => typeof(AdaptivePropertiesPage).FullName;
public ImageSource ControlIcon => new FontImageSource()
{
FontFamily = FontNames.FluentSystemIconsRegular,
Glyph = FluentUIIcon.Ic_fluent_approvals_app_20_regular
};
public string ControlDetail => "A nuget that help MAUI developer adapt their mobile UI application orientations more efficent for simple case";
public string GitHubUrl => $"https://github.com/Strypper/mauisland/tree/main/src/Features/Gallery/Pages/Community/{ControlName}";
public string DocumentUrl => $"https://github.com/rudyspano/MAUI-Adaptive-Properties";
public string GroupName => ControlGroupInfo.GitHubCommunity;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8" ?>
<app:BasePage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:MAUIsland"
Padding="10"
x:Class="MAUIsland.AdaptivePropertiesPage"
x:DataType="app:AdaptivePropertiesPageViewModel"
Title="AdaptiveProperties">
<!--xmlns:m="clr-namespace:AdaptiveProperties.MAUI.M;assembly=AdaptiveProperties.MAUI"-->
<app:BasePage.ToolbarItems>
<ToolbarItem
Command="{x:Binding OpenUrlCommand}"
CommandParameter="{x:Binding ControlInformation.GitHubUrl}"
IconImageSource="github.png"
Text="Source code" />
<ToolbarItem
Command="{x:Binding OpenUrlCommand}"
CommandParameter="{x:Binding ControlInformation.DocumentUrl}"
IconImageSource="microsoft.png"
Text="Original Document" />
</app:BasePage.ToolbarItems>

<app:BasePage.Resources>

<x:String x:Key="PropertiesListHeader">
AdaptiveProperties defines the following properties:
</x:String>

<x:String x:Key="PropertiesListFooter">
These properties are backed by BindableProperty objects, which means that they can be targets of data bindings, and styled.
</x:String>

<x:Array x:Key="PropertiesItemsSource" Type="{x:Type x:String}">
<x:String>
<![CDATA[
<strong style="color:blue">Color</strong>, of type <strong style="color:blue">Color </strong>, value that defines the color of the ActivityIndicator.
]]>
</x:String>
<x:String>
<![CDATA[
<strong style="color:blue">IsRunning</strong>, of type <strong style="color:blue">bool</strong>,value that indicates whether the ActivityIndicator should be visible and animating, or hidden. The default value of this property is false, which indicates that the ActivityIndicator isn't visible.
]]>
</x:String>
</x:Array>


</app:BasePage.Resources>

<ScrollView>
<VerticalStackLayout Spacing="20">
<Frame Style="{x:StaticResource DocumentContentFrameStyle}">
<Label Text="{x:Binding ControlInformation.ControlDetail}" />
</Frame>
<Frame Style="{x:StaticResource DocumentContentFrameStyle}">
<CollectionView
Footer="{x:StaticResource PropertiesListFooter}"
Header="{x:StaticResource PropertiesListHeader}"
ItemsSource="{x:StaticResource PropertiesItemsSource}"
Style="{x:StaticResource PropertiesListStyle}" />
</Frame>
<Frame Style="{x:StaticResource DocumentContentFrameStyle}">
</Frame>

<!--<Grid HeightRequest="200"
BackgroundColor="LightBlue">

<Label Margin="10" VerticalOptions="Center"
FontSize="40"
Text="Hello !!!"
m:T.Text="Hello Tablet User :)" />
</Grid>

<Grid Padding="4" ColumnSpacing="4" RowSpacing="4" RowDefinitions="100,100" ColumnDefinitions="*,*,*"
m:TH.RowDefinitions="200" m:TH.ColumnDefinitions="*,*,*,*"
m:TV.RowDefinitions="200,200" m:TV.ColumnDefinitions="*,*">
<Frame Grid.RowSpan="2"
m:T.RowSpan="1"
BackgroundColor="Red"
CornerRadius="4">
<Label VerticalTextAlignment="Center"
TextColor="White"
Text="ShortCut 1" />
</Frame>
<Frame Grid.Column="1" Grid.RowSpan="2"
m:T.RowSpan="1"
BackgroundColor="Orange"
CornerRadius="4">
<Label VerticalTextAlignment="Center"
TextColor="White"
Text="ShortCut 2" />
</Frame>
<Frame Grid.Column="2"
m:TV.Column="0" m:TV.Row="1"
BackgroundColor="Green"
CornerRadius="4">
<Label VerticalTextAlignment="Center"
TextColor="White"
Text="ShortCut 3" />
</Frame>
<Frame Grid.Row="1" Grid.Column="2"
m:TH.Column="3"
m:TV.Column="1" m:TV.Row="1"
BackgroundColor="Purple"
CornerRadius="4">
<Label VerticalTextAlignment="Center"
TextColor="White"
Text="ShortCut 4" />
</Frame>
</Grid>

<FlexLayout BindableLayout.ItemsSource="{Binding ShelfList}"
JustifyContent="Center" Wrap="Wrap">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="Model:Shelf">
<Grid WidthRequest="180" HeightRequest="150">
<Button BackgroundColor="White" BorderColor="Gray"
Command="{Binding BindingContext.GotToShelfCommand, Source={x:Reference HomePageInstance}}"
CommandParameter="{Binding}"
BorderWidth="1" CornerRadius="0" />

<Grid HeightRequest="100" VerticalOptions="Center" RowDefinitions="80,20"
m:T.HeightRequest="-1" m:T.VerticalOptions="Fill" m:T.RowDefinitions="*"
InputTransparent="True">
<Image Source="{Binding ImageUrl}"
m:T.Aspect="AspectFill" />
<Label Grid.Row="1" HorizontalOptions="Center"
m:T.Row="0" m:T.VerticalOptions="End"
m:T.TextColor="White"
Text="{Binding Name}" />
</Grid>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>-->
</VerticalStackLayout>
</ScrollView>
</app:BasePage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MAUIsland;
public partial class AdaptivePropertiesPage : IControlPage
{
#region [CTor]
public AdaptivePropertiesPage(AdaptivePropertiesPageViewModel vm)
{
InitializeComponent();

BindingContext = vm;
}
#endregion


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
namespace MAUIsland;
public partial class AdaptivePropertiesPageViewModel : NavigationAwareBaseViewModel
{
#region [Fields]
public List<Shelf> ShelfList { get; set; } = new();
#endregion

#region [CTor]
public AdaptivePropertiesPageViewModel(
IAppNavigator appNavigator
) : base(appNavigator)
{
List<Product> productList = new();
productList.Add(new Product { Name = "Product1", Description = "none", ImageUrl = "none", Price = "NotMuch" });
productList.Add(new Product { Name = "Product2", Description = "none", ImageUrl = "none", Price = "NotMuch" });
productList.Add(new Product { Name = "Product3", Description = "none", ImageUrl = "none", Price = "NotMuch" });
productList.Add(new Product { Name = "Product4", Description = "none", ImageUrl = "none", Price = "NotMuch" });
productList.Add(new Product { Name = "Product5", Description = "none", ImageUrl = "none", Price = "NotMuch" });

ShelfList.Add(new Shelf(1) { Name = "cover1", ImageUrl = "none", ProductList = productList });
ShelfList.Add(new Shelf(2) { Name = "cover2", ImageUrl = "none", ProductList = productList });
ShelfList.Add(new Shelf(3) { Name = "cover3", ImageUrl = "none", ProductList = productList });
ShelfList.Add(new Shelf(4) { Name = "cover4", ImageUrl = "none", ProductList = productList });

}
#endregion

#region [Properties]
[ObservableProperty]
IControlInfo controlInformation;
#endregion

#region [Overrides]
protected override void OnInit(IDictionary<string, object> query)
{
base.OnInit(query);

ControlInformation = query.GetData<IControlInfo>();

}
#endregion

#region [Model]
public class Shelf
{
public int Id { get; set; }
public string Name { get; set; }
public string ImageUrl { get; set; }
public List<Product> ProductList { get; internal set; } = new List<Product>();

public Shelf(int id)
{
Id = id;
}
}

public class Product
{
public string Name { get; set; }

public string Description { get; set; }

public string ImageUrl { get; set; }

public string Price { get; set; }
}
#endregion
}