Skip to content

Commit c9ed7bd

Browse files
Added example demo
1 parent 9144e1a commit c9ed7bd

Some content is hidden

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

66 files changed

+1808
-1
lines changed

CheckBoxFiltering/App.xaml

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:CheckBoxFiltering"
5+
x:Class="CheckBoxFiltering.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>

CheckBoxFiltering/App.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace CheckBoxFiltering
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
12+
}

CheckBoxFiltering/AppShell.xaml

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+
<Shell
3+
x:Class="CheckBoxFiltering.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:CheckBoxFiltering"
7+
Shell.FlyoutBehavior="Disabled"
8+
Title="CheckBoxFiltering">
9+
10+
<ShellContent
11+
Title="Mastering Shopping: Enhancing Your Product Search with the .NET Maui CheckBox"
12+
ContentTemplate="{DataTemplate local:MainPage}"
13+
Route="MainPage" />
14+
15+
</Shell>

CheckBoxFiltering/AppShell.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace CheckBoxFiltering
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.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);net8.0-tizen</TargetFrameworks> -->
8+
9+
<!-- Note for MacCatalyst:
10+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
11+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
12+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
13+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
14+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
15+
16+
<OutputType>Exe</OutputType>
17+
<RootNamespace>CheckBoxFiltering</RootNamespace>
18+
<UseMaui>true</UseMaui>
19+
<SingleProject>true</SingleProject>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
<Nullable>enable</Nullable>
22+
23+
<!-- Display name -->
24+
<ApplicationTitle>CheckBoxFiltering</ApplicationTitle>
25+
26+
<!-- App Identifier -->
27+
<ApplicationId>com.companyname.checkboxfiltering</ApplicationId>
28+
29+
<!-- Versions -->
30+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
31+
<ApplicationVersion>1</ApplicationVersion>
32+
33+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
34+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
35+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
36+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
37+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
38+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
39+
</PropertyGroup>
40+
41+
<ItemGroup>
42+
<!-- App Icon -->
43+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
44+
45+
<!-- Splash Screen -->
46+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
47+
48+
<!-- Images -->
49+
<MauiImage Include="Resources\Images\*" />
50+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
51+
52+
<!-- Custom Fonts -->
53+
<MauiFont Include="Resources\Fonts\*" />
54+
55+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
56+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
57+
</ItemGroup>
58+
59+
<ItemGroup>
60+
<None Remove="Resources\Images\brownshoe_01.png" />
61+
<None Remove="Resources\Images\brownshoe_02.png" />
62+
<None Remove="Resources\Images\brownshoe_03.png" />
63+
<None Remove="Resources\Images\brownshoe_04.png" />
64+
<None Remove="Resources\Images\brownshoe_05.png" />
65+
<None Remove="Resources\Images\greenshoe_01.png" />
66+
<None Remove="Resources\Images\greenshoe_02.png" />
67+
<None Remove="Resources\Images\greenshoe_03.png" />
68+
<None Remove="Resources\Images\greenshoe_04.png" />
69+
<None Remove="Resources\Images\greenshoe_05.png" />
70+
<None Remove="Resources\Images\redshoe_01.png" />
71+
<None Remove="Resources\Images\redshoe_02.png" />
72+
<None Remove="Resources\Images\redshoe_03.png" />
73+
<None Remove="Resources\Images\redshoe_04.png" />
74+
<None Remove="Resources\Images\redshoe_05.png" />
75+
<None Remove="Resources\Images\sandalshoe_01.png" />
76+
<None Remove="Resources\Images\sandalshoe_02.png" />
77+
<None Remove="Resources\Images\sandalshoe_03.png" />
78+
<None Remove="Resources\Images\sandalshoe_04.png" />
79+
<None Remove="Resources\Images\sandalshoe_05.png" />
80+
<None Remove="Resources\Images\violetshoe_01.png" />
81+
<None Remove="Resources\Images\violetshoe_02.png" />
82+
<None Remove="Resources\Images\violetshoe_03.png" />
83+
<None Remove="Resources\Images\violetshoe_04.png" />
84+
<None Remove="Resources\Images\violetshoe_05.png" />
85+
</ItemGroup>
86+
87+
<ItemGroup>
88+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
89+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
90+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
91+
<PackageReference Include="Syncfusion.Maui.Buttons" Version="*" />
92+
<PackageReference Include="Syncfusion.Maui.ListView" Version="*" />
93+
</ItemGroup>
94+
95+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
5+
<ActiveDebugFramework>net8.0-windows10.0.19041.0</ActiveDebugFramework>
6+
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<None Update="App.xaml">
10+
<SubType>Designer</SubType>
11+
</None>
12+
<None Update="AppShell.xaml">
13+
<SubType>Designer</SubType>
14+
</None>
15+
<None Update="MainPage.xaml">
16+
<SubType>Designer</SubType>
17+
</None>
18+
<None Update="Platforms\Windows\App.xaml">
19+
<SubType>Designer</SubType>
20+
</None>
21+
<None Update="Platforms\Windows\Package.appxmanifest">
22+
<SubType>Designer</SubType>
23+
</None>
24+
<None Update="Resources\Styles\Colors.xaml">
25+
<SubType>Designer</SubType>
26+
</None>
27+
<None Update="Resources\Styles\Styles.xaml">
28+
<SubType>Designer</SubType>
29+
</None>
30+
</ItemGroup>
31+
</Project>
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.9.34607.119
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckBoxFiltering", "CheckBoxFiltering.csproj", "{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}"
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+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{199C6F50-EE45-4BD8-91A0-4D6284AEC1FA}.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 = {E51C983A-2AC4-4578-AAC4-C7F7DCC770B1}
26+
EndGlobalSection
27+
EndGlobal

CheckBoxFiltering/MainPage.xaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:buttons="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.Buttons"
5+
xmlns:listView="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
6+
xmlns:local="clr-namespace:CheckBoxFiltering"
7+
x:Class="CheckBoxFiltering.MainPage">
8+
9+
<ContentPage.Resources>
10+
<local:ProductInfoViewModel x:Key="ViewModel"/>
11+
12+
<Style TargetType="Border" x:Key="ColorBorder">
13+
<Setter Property="Stroke" Value="Gray"/>
14+
<Setter Property="StrokeThickness" Value="0"/>
15+
<Setter Property="HeightRequest" Value="15"/>
16+
<Setter Property="WidthRequest" Value="15"/>
17+
<Setter Property="StrokeShape" Value="RoundRectangle 7.5"/>
18+
</Style>
19+
</ContentPage.Resources>
20+
21+
<Grid ColumnDefinitions="2*,8*" >
22+
<Border Grid.Column="0" Margin="5" Padding="5"
23+
Stroke="Gray" StrokeThickness="0.3" StrokeShape="RoundRectangle 10">
24+
<ScrollView>
25+
<StackLayout Spacing="5">
26+
<Label Margin="10,5" FontSize="16" VerticalTextAlignment="Center"
27+
FontFamily="Roboto-Medium" Text="Filters" FontAttributes="Bold"/>
28+
<Label Margin="10,0" FontFamily="Roboto-Medium" FontSize="14"
29+
Padding="0,10,0,0" Text="Brand" FontAttributes="Bold"/>
30+
<StackLayout>
31+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="Campus" IsChecked="{Binding BrandFilterChecked1}"/>
32+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="Skechers" IsChecked="{Binding BrandFilterChecked2}"/>
33+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="Red Tape" IsChecked="{Binding BrandFilterChecked3}"/>
34+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="Roadster" IsChecked="{Binding BrandFilterChecked4}"/>
35+
</StackLayout>
36+
<Label Margin="10,0" FontFamily="Roboto-Medium" FontSize="14"
37+
Padding="0,20,0,0" Text="Size" FontAttributes="Bold"/>
38+
<StackLayout>
39+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="7" IsChecked="{Binding SizeFilterChecked2}"/>
40+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="8" IsChecked="{Binding SizeFilterChecked3}"/>
41+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="9" IsChecked="{Binding SizeFilterChecked4}"/>
42+
<buttons:SfCheckBox BindingContext="{x:StaticResource ViewModel}" HorizontalOptions="Start" Text="10" IsChecked="{Binding SizeFilterChecked5}"/>
43+
</StackLayout>
44+
<Label Margin="10,0" FontFamily="Roboto-Medium" FontSize="14"
45+
Padding="0,20,0,0" Text="Colors" FontAttributes="Bold"/>
46+
<StackLayout>
47+
<HorizontalStackLayout >
48+
<buttons:SfCheckBox x:Name="brown" HorizontalOptions="Start" BindingContext="{x:StaticResource ViewModel}" IsChecked="{Binding ColorFilterChecked1}"/>
49+
<Border Style="{x:StaticResource ColorBorder}">
50+
<BoxView Color="SandyBrown" />
51+
</Border>
52+
<Label Text="Brown" Margin="5" VerticalTextAlignment="Center">
53+
<Label.GestureRecognizers>
54+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
55+
</Label.GestureRecognizers>
56+
</Label>
57+
</HorizontalStackLayout>
58+
<HorizontalStackLayout>
59+
<buttons:SfCheckBox x:Name="green" HorizontalOptions="Start" BindingContext="{x:StaticResource ViewModel}" IsChecked="{Binding ColorFilterChecked2}"/>
60+
<Border Style="{x:StaticResource ColorBorder}">
61+
<BoxView Color="Green" />
62+
</Border>
63+
<Label Text="Green" Margin="5" VerticalTextAlignment="Center">
64+
<Label.GestureRecognizers>
65+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_1"/>
66+
</Label.GestureRecognizers>
67+
</Label>
68+
</HorizontalStackLayout>
69+
<HorizontalStackLayout>
70+
<buttons:SfCheckBox x:Name="red" HorizontalOptions="Start" BindingContext="{x:StaticResource ViewModel}" IsChecked="{Binding ColorFilterChecked3}"/>
71+
<Border Style="{x:StaticResource ColorBorder}">
72+
<BoxView Color="Red" />
73+
</Border>
74+
<Label Text="Red" Margin="5" VerticalTextAlignment="Center">
75+
<Label.GestureRecognizers>
76+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_2"/>
77+
</Label.GestureRecognizers>
78+
</Label>
79+
</HorizontalStackLayout>
80+
<HorizontalStackLayout>
81+
<buttons:SfCheckBox x:Name="sandal" HorizontalOptions="Start" BindingContext="{x:StaticResource ViewModel}" IsChecked="{Binding ColorFilterChecked4}"/>
82+
<Border Style="{x:StaticResource ColorBorder}">
83+
<BoxView Color="Tan"/>
84+
</Border>
85+
<Label Text="Sandal" Margin="5" VerticalTextAlignment="Center">
86+
<Label.GestureRecognizers>
87+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_3"/>
88+
</Label.GestureRecognizers>
89+
</Label>
90+
</HorizontalStackLayout>
91+
<HorizontalStackLayout>
92+
<buttons:SfCheckBox x:Name="violet" HorizontalOptions="Start" BindingContext="{x:StaticResource ViewModel}" IsChecked="{Binding ColorFilterChecked5}"/>
93+
<Border Style="{x:StaticResource ColorBorder}">
94+
<BoxView Color="DarkViolet" />
95+
</Border>
96+
<Label Text="Violet" Margin="5" VerticalTextAlignment="Center">
97+
<Label.GestureRecognizers>
98+
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_4"/>
99+
</Label.GestureRecognizers>
100+
</Label>
101+
</HorizontalStackLayout>
102+
</StackLayout>
103+
</StackLayout>
104+
</ScrollView>
105+
</Border>
106+
107+
<Border Grid.Column="1" Margin="5" Padding="5"
108+
Stroke="Gray" StrokeThickness="0.3" StrokeShape="RoundRectangle 10">
109+
110+
<listView:SfListView BindingContext="{x:StaticResource ViewModel}" SelectionMode="None" ItemSpacing="5" ItemSize="260" ItemsSource="{Binding Filtered}" >
111+
<listView:SfListView.ItemsLayout>
112+
<listView:GridLayout SpanCount="3" />
113+
</listView:SfListView.ItemsLayout>
114+
<listView:SfListView.ItemTemplate>
115+
<DataTemplate>
116+
<ViewCell>
117+
<Border Stroke="Gray"
118+
StrokeThickness="0.3" Margin="0,0,7,0"
119+
StrokeShape="RoundRectangle 0">
120+
<Grid Margin="5" RowDefinitions="7*,3*">
121+
<Image Source="{Binding Image}"/>
122+
<Grid RowDefinitions="1*,3*" Grid.Row="1" Margin="0,10"
123+
Padding="5,0" RowSpacing="5" VerticalOptions="EndAndExpand">
124+
<Label FontSize="14" VerticalTextAlignment="Center"
125+
Text="{Binding Brand}" FontFamily="Roboto-Medium"/>
126+
<Label Grid.Row="1" FontFamily="Roboto-Regular" Text="{Binding Description}" LineBreakMode="WordWrap"/>
127+
</Grid>
128+
</Grid>
129+
</Border>
130+
</ViewCell>
131+
</DataTemplate>
132+
</listView:SfListView.ItemTemplate>
133+
</listView:SfListView>
134+
</Border>
135+
</Grid>
136+
137+
138+
</ContentPage>

0 commit comments

Comments
 (0)