Skip to content

Commit 29d6bab

Browse files
Add files via upload
1 parent f9b5330 commit 29d6bab

Some content is hidden

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

69 files changed

+1561
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31611.283
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyViewTemplateDemo", "EmptyViewTemplateDemo\EmptyViewTemplateDemo.csproj", "{8232399F-8579-4D07-9A82-7A6BD33AA02E}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{8232399F-8579-4D07-9A82-7A6BD33AA02E}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
26+
EndGlobalSection
27+
EndGlobal
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:EmptyViewTemplateDemo"
5+
x:Class="EmptyViewTemplateDemo.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace EmptyViewTemplateDemo;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="EmptyViewTemplateDemo.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:EmptyViewTemplateDemo"
7+
Shell.FlyoutBehavior="Disabled">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace EmptyViewTemplateDemo;
2+
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>EmptyViewTemplateDemo</RootNamespace>
10+
<UseMaui>true</UseMaui>
11+
<SingleProject>true</SingleProject>
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
14+
<!-- Display name -->
15+
<ApplicationTitle>EmptyViewTemplateDemo</ApplicationTitle>
16+
17+
<!-- App Identifier -->
18+
<ApplicationId>com.companyname.emptyviewtemplatedemo</ApplicationId>
19+
<ApplicationIdGuid>E4774022-9C8D-493C-834A-F0167FE0B1B8</ApplicationIdGuid>
20+
21+
<!-- Versions -->
22+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
23+
<ApplicationVersion>1</ApplicationVersion>
24+
25+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
29+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
30+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<!-- App Icon -->
35+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
36+
37+
<!-- Splash Screen -->
38+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
39+
40+
<!-- Images -->
41+
<MauiImage Include="Resources\Images\*" />
42+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
43+
44+
<!-- Custom Fonts -->
45+
<MauiFont Include="Resources\Fonts\*" />
46+
47+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
48+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
49+
</ItemGroup>
50+
51+
<ItemGroup>
52+
<None Remove="Resources\Fonts\ListViewFontIcons.ttf" />
53+
<None Remove="Resources\Fonts\Roboto-Medium.ttf" />
54+
<None Remove="Resources\Fonts\Roboto-Regular.ttf" />
55+
<None Remove="Resources\Images\bags.png" />
56+
<None Remove="Resources\Images\camera.png" />
57+
<None Remove="Resources\Images\cameraaccessories.png" />
58+
<None Remove="Resources\Images\computeraccessories.png" />
59+
<None Remove="Resources\Images\coolingglasses.png" />
60+
<None Remove="Resources\Images\cosmetics.png" />
61+
<None Remove="Resources\Images\crocs.png" />
62+
<None Remove="Resources\Images\desktops.png" />
63+
<None Remove="Resources\Images\headsets.png" />
64+
<None Remove="Resources\Images\jewelries.png" />
65+
<None Remove="Resources\Images\laptops.png" />
66+
<None Remove="Resources\Images\ListViewFontIcons.ttf" />
67+
<None Remove="Resources\Images\memorycards.png" />
68+
<None Remove="Resources\Images\mobiles.png" />
69+
<None Remove="Resources\Images\monitors.png" />
70+
<None Remove="Resources\Images\musical.png" />
71+
<None Remove="Resources\Images\pendrives.png" />
72+
<None Remove="Resources\Images\poweraccessories.png" />
73+
<None Remove="Resources\Images\printers.png" />
74+
<None Remove="Resources\Images\Roboto-Medium.ttf" />
75+
<None Remove="Resources\Images\Roboto-Regular.ttf" />
76+
<None Remove="Resources\Images\router.png" />
77+
<None Remove="Resources\Images\shoes.png" />
78+
<None Remove="Resources\Images\smartwatches.png" />
79+
<None Remove="Resources\Images\soundbars.png" />
80+
<None Remove="Resources\Images\storagedevices.png" />
81+
<None Remove="Resources\Images\telephone.png" />
82+
<None Remove="Resources\Images\watchimage.png" />
83+
</ItemGroup>
84+
85+
<ItemGroup>
86+
<PackageReference Include="Syncfusion.Maui.Core" Version="20.31.231" />
87+
<PackageReference Include="Syncfusion.Maui.DataSource" Version="20.31.201" />
88+
<PackageReference Include="Syncfusion.Maui.GridCommon" Version="20.31.201" />
89+
<PackageReference Include="Syncfusion.Maui.ListView" Version="20.31.214" />
90+
</ItemGroup>
91+
92+
<ItemGroup>
93+
<MauiXaml Update="View\MainPage.xaml">
94+
<Generator>MSBuild:Compile</Generator>
95+
</MauiXaml>
96+
</ItemGroup>
97+
98+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugFramework>net6.0-android</ActiveDebugFramework>
5+
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
6+
<ActiveDebugProfile>Pixel 5 - API 30 (Android 11.0 - API 30)</ActiveDebugProfile>
7+
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
8+
<DefaultDevice>pixel_5_-_api_30</DefaultDevice>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<MauiXaml Update="View\MainPage.xaml">
12+
<SubType>Designer</SubType>
13+
</MauiXaml>
14+
</ItemGroup>
15+
</Project>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
using Microsoft.Maui.Controls;
2+
using Syncfusion.Maui.DataSource;
3+
4+
5+
namespace EmptyViewTemplateDemo
6+
{
7+
#region SortingFilteringBehavior
8+
9+
public class SfListViewSortingFilteringBehavior : Behavior<ContentPage>
10+
{
11+
#region Fields
12+
13+
private Syncfusion.Maui.ListView.SfListView ListView;
14+
private SortingFilteringViewModel sortingFilteringViewModel;
15+
private Grid sortImageParent;
16+
private SearchBar searchBar = null;
17+
private Grid headerGrid;
18+
19+
#endregion
20+
21+
private void InitialSorting()
22+
{
23+
sortingFilteringViewModel.SortingOptions = ListViewSortOptions.Ascending;
24+
ListView.DataSource.SortDescriptors.Clear();
25+
if (sortingFilteringViewModel.SortingOptions != ListViewSortOptions.None)
26+
{
27+
ListView.DataSource.SortDescriptors.Add(new SortDescriptor()
28+
{
29+
PropertyName = "Quantity",
30+
Direction = sortingFilteringViewModel.SortingOptions == ListViewSortOptions.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending
31+
});
32+
}
33+
ListView.RefreshView();
34+
}
35+
#region Overrides
36+
protected override void OnAttachedTo(ContentPage bindable)
37+
{
38+
ListView = bindable.FindByName<Syncfusion.Maui.ListView.SfListView>("listView");
39+
sortingFilteringViewModel = new SortingFilteringViewModel();
40+
ListView.BindingContext = sortingFilteringViewModel;
41+
ListView.ItemsSource = sortingFilteringViewModel.Items;
42+
43+
headerGrid = bindable.FindByName<Grid>("headerGrid");
44+
headerGrid.BindingContext = sortingFilteringViewModel;
45+
46+
sortImageParent = bindable.FindByName<Grid>("sortImageParent");
47+
var SortImageTapped = new TapGestureRecognizer() { Command = new Command(SortImageTapped_Tapped) };
48+
sortImageParent.GestureRecognizers.Add(SortImageTapped);
49+
50+
searchBar = bindable.FindByName<SearchBar>("filterText");
51+
searchBar.TextChanged += SearchBar_TextChanged;
52+
InitialSorting();
53+
base.OnAttachedTo(bindable);
54+
}
55+
56+
protected override void OnDetachingFrom(ContentPage bindable)
57+
{
58+
ListView = null;
59+
sortImageParent = null;
60+
searchBar = null;
61+
searchBar.TextChanged -= SearchBar_TextChanged;
62+
base.OnDetachingFrom(bindable);
63+
}
64+
65+
#endregion
66+
67+
#region Events
68+
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
69+
{
70+
searchBar = (sender as SearchBar);
71+
if (ListView.DataSource != null)
72+
{
73+
ListView.DataSource.Filter = FilterContacts;
74+
ListView.DataSource.RefreshFilter();
75+
}
76+
ListView.RefreshView();
77+
}
78+
79+
private void SortImageTapped_Tapped()
80+
{
81+
if (sortingFilteringViewModel.SortingOptions == ListViewSortOptions.Descending)
82+
sortingFilteringViewModel.SortingOptions = ListViewSortOptions.Ascending;
83+
else if (sortingFilteringViewModel.SortingOptions == ListViewSortOptions.None)
84+
sortingFilteringViewModel.SortingOptions = ListViewSortOptions.Ascending;
85+
else if (sortingFilteringViewModel.SortingOptions == ListViewSortOptions.Ascending)
86+
sortingFilteringViewModel.SortingOptions = ListViewSortOptions.Descending;
87+
88+
ListView.DataSource.SortDescriptors.Clear();
89+
if (sortingFilteringViewModel.SortingOptions != ListViewSortOptions.None)
90+
{
91+
ListView.DataSource.SortDescriptors.Add(new SortDescriptor()
92+
{
93+
PropertyName = "Quantity",
94+
Direction = sortingFilteringViewModel.SortingOptions == ListViewSortOptions.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending
95+
});
96+
}
97+
ListView.RefreshView();
98+
}
99+
100+
#endregion
101+
102+
#region Methods
103+
private bool FilterContacts(object obj)
104+
{
105+
if (searchBar == null || searchBar.Text == null)
106+
return true;
107+
108+
var productInfo = obj as ProductInfo;
109+
return (productInfo.ProductName.ToLower().Contains(searchBar.Text.ToLower()) || (productInfo.Quantity.ToString()).ToLower().Contains(searchBar.Text.ToLower()));
110+
}
111+
112+
#endregion
113+
}
114+
115+
#endregion
116+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.Maui.Controls;
2+
using System;
3+
using System.Globalization;
4+
5+
6+
namespace EmptyViewTemplateDemo
7+
{
8+
public class ListViewBoolToSortImageConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
var sortOptions = (ListViewSortOptions)value;
13+
if (sortOptions == ListViewSortOptions.Ascending)
14+
return "\ue709";
15+
else if (sortOptions == ListViewSortOptions.Descending)
16+
return "\ue719";
17+
else
18+
return "\ue709";
19+
}
20+
21+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22+
{
23+
throw new NotImplementedException();
24+
}
25+
}
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace EmptyViewTemplateDemo
8+
{
9+
public class FilterItem : BindableObject
10+
{
11+
public static readonly BindableProperty FilterProperty = BindableProperty.Create(nameof(Filter), typeof(string), typeof(FilterItem), null);
12+
13+
public string Filter
14+
{
15+
get { return (string)GetValue(FilterProperty); }
16+
set { SetValue(FilterProperty, value); }
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)