Skip to content

Commit

Permalink
Sample update
Browse files Browse the repository at this point in the history
  • Loading branch information
VimalaThirumalaiKumarSF3739 committed Mar 14, 2024
1 parent 7a9f5db commit cc39bf6
Show file tree
Hide file tree
Showing 105 changed files with 2,345 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ParallaxViewCustomControl/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ParallaxViewCustomControl"
x:Class="ParallaxViewCustomControl.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions ParallaxViewCustomControl/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ParallaxViewCustomControl
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new MainPage();
}
}
}
15 changes: 15 additions & 0 deletions ParallaxViewCustomControl/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="ParallaxViewCustomControl.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ParallaxViewCustomControl"
Shell.FlyoutBehavior="Disabled"
Title="ParallaxViewCustomControl">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
10 changes: 10 additions & 0 deletions ParallaxViewCustomControl/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ParallaxViewCustomControl
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
45 changes: 45 additions & 0 deletions ParallaxViewCustomControl/CustomControl/CustomListView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Syncfusion.Maui.Core;
using System.Collections;

namespace ParallaxViewCustomControl
{
public class CustomListView : ListView, IParallaxView
{
public double ItemMargin { get; set; }
public Size ScrollableContentSize { get; set; }

public event EventHandler<ParallaxScrollingEventArgs>? Scrolling;

public CustomListView()
{
this.Scrolled += CustomListView_Scrolled;

#if ANDROID
var info = DeviceDisplay.Current.MainDisplayInfo;
ItemMargin = info.Density * 4;
#endif
}

private void CustomListView_Scrolled(object? sender, ScrolledEventArgs e)
{
if (sender is ListView listView && Scrolling != null)
{
Scrolling.Invoke(this, new ParallaxScrollingEventArgs(e.ScrollX, e.ScrollY, false));
}
}

protected override Size MeasureOverride(double widthConstraint, double heightConstraint)
{
var minimumSize = new Size(40, 40);
Size request = Size.Zero;

if (ItemsSource is IList list && HasUnevenRows == false && RowHeight > 0 && !IsGroupingEnabled)
{
request = new Size(widthConstraint, list.Count * RowHeight + ItemMargin);
}

this.ScrollableContentSize = new SizeRequest(request, minimumSize);
return base.MeasureOverride(widthConstraint, heightConstraint);
}
}
}
44 changes: 44 additions & 0 deletions ParallaxViewCustomControl/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ParallaxViewCustomControl.MainPage"
xmlns:parallax="clr-namespace:Syncfusion.Maui.ParallaxView;assembly=Syncfusion.Maui.ParallaxView"
xmlns:local="clr-namespace:ParallaxViewCustomControl">

<ContentPage.Content>
<Grid>

<Grid.BindingContext>
<local:ParallaxViewModel x:Name="viewModel"/>
</Grid.BindingContext>

<parallax:SfParallaxView Source="{x:Reference Name = listview}" x:Name="parallaxview" >
<parallax:SfParallaxView.Content>
<Image BackgroundColor="Transparent" Source="{Binding Image}" HorizontalOptions="Fill" VerticalOptions="Fill" Aspect="AspectFill" />
</parallax:SfParallaxView.Content>
</parallax:SfParallaxView>

<local:CustomListView x:Name="listview" ItemsSource="{Binding Items}" BackgroundColor="Transparent" RowHeight="100">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image BackgroundColor="Transparent" HeightRequest="90" HorizontalOptions="CenterAndExpand"
WidthRequest="90" Source="{Binding ItemImage}" Grid.Column="0" VerticalOptions="CenterAndExpand" Aspect="AspectFit" />
<StackLayout BackgroundColor="Transparent" Grid.Column="1" VerticalOptions="CenterAndExpand"
HorizontalOptions="FillAndExpand" Orientation="Vertical">
<Label HorizontalOptions="FillAndExpand" TextColor="White" Text="{Binding Name}"/>
<Label HorizontalOptions="FillAndExpand" Text="{Binding Author}" TextColor="White"/>
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</local:CustomListView>
</Grid>
</ContentPage.Content>
</ContentPage>
10 changes: 10 additions & 0 deletions ParallaxViewCustomControl/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ParallaxViewCustomControl
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
}
27 changes: 27 additions & 0 deletions ParallaxViewCustomControl/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using Syncfusion.Maui.Core.Hosting;

namespace ParallaxViewCustomControl
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureSyncfusionCore()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
}
}
22 changes: 22 additions & 0 deletions ParallaxViewCustomControl/Model/Contacts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

namespace ParallaxViewCustomControl
{
public class Contacts
{
public string? Name
{
get;
set;
}
public string? Author
{
get;
set;
}
public ImageSource? ItemImage
{
get;
set;
}
}
}
95 changes: 95 additions & 0 deletions ParallaxViewCustomControl/ParallaxViewCustomControl.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>ParallaxViewCustomControl</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<ApplicationTitle>ParallaxViewCustomControl</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.parallaxviewcustomcontrol</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<MauiImage Remove="Resources\Images\parallax.jpg" />
<MauiImage Remove="Resources\Images\parallax0.png" />
<MauiImage Remove="Resources\Images\parallax1.png" />
<MauiImage Remove="Resources\Images\parallax2.png" />
<MauiImage Remove="Resources\Images\parallax3.png" />
<MauiImage Remove="Resources\Images\parallax4.png" />
<MauiImage Remove="Resources\Images\parallax5.png" />
<MauiImage Remove="Resources\Images\parallax6.png" />
<MauiImage Remove="Resources\Images\parallax7.png" />
<MauiImage Remove="Resources\Images\parallax8.png" />
<MauiImage Remove="Resources\Images\parallax9.png" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\Images\parallax.jpg" />
<EmbeddedResource Include="Resources\Images\parallax0.png" />
<EmbeddedResource Include="Resources\Images\parallax1.png" />
<EmbeddedResource Include="Resources\Images\parallax2.png" />
<EmbeddedResource Include="Resources\Images\parallax3.png" />
<EmbeddedResource Include="Resources\Images\parallax4.png" />
<EmbeddedResource Include="Resources\Images\parallax5.png" />
<EmbeddedResource Include="Resources\Images\parallax6.png" />
<EmbeddedResource Include="Resources\Images\parallax7.png" />
<EmbeddedResource Include="Resources\Images\parallax8.png" />
<EmbeddedResource Include="Resources\Images\parallax9.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Syncfusion.Maui.Core" Version="*" />
<PackageReference Include="Syncfusion.Maui.ParallaxView" Version="*" />
</ItemGroup>

</Project>
27 changes: 27 additions & 0 deletions ParallaxViewCustomControl/ParallaxViewCustomControl.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParallaxViewCustomControl", "ParallaxViewCustomControl.csproj", "{8320F73C-EB67-43BA-BB79-81A95E2F006F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Release|Any CPU.Build.0 = Release|Any CPU
{8320F73C-EB67-43BA-BB79-81A95E2F006F}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5A60EFFC-2DE8-4A6C-8376-5566D2765927}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions ParallaxViewCustomControl/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace ParallaxViewCustomControl
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
16 changes: 16 additions & 0 deletions ParallaxViewCustomControl/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace ParallaxViewCustomControl
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
10 changes: 10 additions & 0 deletions ParallaxViewCustomControl/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace ParallaxViewCustomControl
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
Loading

0 comments on commit cc39bf6

Please sign in to comment.