.NET MAUI Community Toolkit Gallery (#8)
* .NET MAUI Community Toolkit sample * Update Namespace * Remove Redundant Folder * Remove WinUI Sample * Use MAUI Namespace * Remove WinUI Folder * Create global.json Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
This commit is contained in:
Родитель
7aa9278f24
Коммит
32e59cbd20
|
@ -0,0 +1,48 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31521.260
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui", "..\src\CommunityToolkit.Maui\CommunityToolkit.Maui.csproj", "{71B583D9-470D-476C-BB1A-4AC663D1A339}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.UnitTests", "..\src\CommunityToolkit.Maui.UnitTests\CommunityToolkit.Maui.UnitTests.csproj", "{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{AE67B86A-46F2-4078-BF02-0614B7E0E3F5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.Sample", "CommunityToolkit.Maui.Sample\CommunityToolkit.Maui.Sample.csproj", "{3A795407-604F-4502-8C76-281BE5575A84}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{71B583D9-470D-476C-BB1A-4AC663D1A339}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7D49CC16-93CF-471B-B1FA-0BA44DECC15D}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3A795407-604F-4502-8C76-281BE5575A84}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{3A795407-604F-4502-8C76-281BE5575A84} = {AE67B86A-46F2-4078-BF02-0614B7E0E3F5}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1E9E61C1-5CB7-4C8E-87BA-6C1D38238679}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,74 @@
|
|||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls"
|
||||
xmlns:local="clr-namespace:CommunityToolkit.Maui.Sample"
|
||||
x:Class="CommunityToolkit.Maui.Sample.App"
|
||||
windows:Application.ImageDirectory="Assets">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<!-- Colors -->
|
||||
<Color x:Key="AppBackgroundColor">#FAFAFA</Color>
|
||||
<Color x:Key="PrimaryColor">#FAFAFA</Color>
|
||||
<Color x:Key="NavigationBarTextColor">#5D5D5D</Color>
|
||||
<Color x:Key="NormalButtonBackgroundColor">#1976D2</Color>
|
||||
<Color x:Key="NormalButtonTextColor">#FFFFFF</Color>
|
||||
<Color x:Key="HeadingLabelTextColor">#5D5D5D</Color>
|
||||
<Color x:Key="NormalLabelTextColor">#888888</Color>
|
||||
<Color x:Key="DarkLabelTextColor">#000000</Color>
|
||||
<Color x:Key="DarkLabelPlaceholderColor">#333d47</Color>
|
||||
<Color x:Key="SoftFrameBackgroundColor">#ecf0f9</Color>
|
||||
<Color x:Key="StatusbarColor">#1976D2</Color>
|
||||
<Color x:Key="NavBarColor">#1976D2</Color>
|
||||
|
||||
<!-- Implicit styles -->
|
||||
<Style ApplyToDerivedTypes="True" TargetType="NavigationPage">
|
||||
<Setter Property="BarBackgroundColor" Value="{StaticResource PrimaryColor}" />
|
||||
<Setter Property="BarTextColor" Value="{StaticResource NavigationBarTextColor}" />
|
||||
</Style>
|
||||
|
||||
<Style ApplyToDerivedTypes="True" TargetType="ContentPage">
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource AppBackgroundColor}" />
|
||||
<Setter Property="NavigationPage.BackButtonTitle" Value="" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="FontSize" Value="Medium" />
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource NormalButtonBackgroundColor}" />
|
||||
<Setter Property="TextColor" Value="{StaticResource NormalButtonTextColor}" />
|
||||
<Setter Property="CornerRadius" Value="5" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="FontSize" Value="Body" />
|
||||
<Setter Property="TextColor" Value="{StaticResource NormalLabelTextColor}" />
|
||||
<Setter Property="VerticalTextAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalTextAlignment" Value="Start" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="StackLayout">
|
||||
<Setter Property="Spacing" Value="0" />
|
||||
</Style>
|
||||
|
||||
<!-- Styles -->
|
||||
<Style x:Key="card" TargetType="Frame">
|
||||
<Setter Property="BackgroundColor" Value="#ffffff" />
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
<Setter Property="HasShadow" Value="True" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="label_welcome_header" TargetType="Label">
|
||||
<Setter Property="FontSize" Value="Title" />
|
||||
<Setter Property="TextColor" Value="{StaticResource HeadingLabelTextColor}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="label_section_header" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{StaticResource HeadingLabelTextColor}" />
|
||||
</Style>
|
||||
|
||||
<!-- Values -->
|
||||
<Thickness x:Key="ContentPadding">20, 0</Thickness>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,15 @@
|
|||
using CommunityToolkit.Maui.Sample.Pages;
|
||||
using Application = Microsoft.Maui.Controls.Application;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MainPage = new BaseNavigationPage(new MainPage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- iOS, Android, MacCatalyst -->
|
||||
<TargetFrameworks>net6.0-ios;net6.0-android;net6.0-maccatalyst</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<UseMaui>true</UseMaui>
|
||||
<SingleProject>true</SingleProject>
|
||||
<RootNamespace>CommunityToolkit.Maui.Sample</RootNamespace>
|
||||
|
||||
<!-- Display name -->
|
||||
<ApplicationTitle>CommunityToolkit.Maui.Sample</ApplicationTitle>
|
||||
|
||||
<!-- App Identifier -->
|
||||
<ApplicationId>com.microsoft.CommunityToolkit.Maui.Sample</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationVersion>1.0</ApplicationVersion>
|
||||
<AndroidVersionCode>1</AndroidVersionCode>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- App Icon -->
|
||||
<MauiImage Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" IsAppIcon="true" Color="#512BD4" />
|
||||
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" />
|
||||
|
||||
<!-- Images -->
|
||||
<MauiImage Include="Resources\Images\*" />
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<MauiFont Include="Resources\Fonts\*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\CommunityToolkit.Maui\CommunityToolkit.Maui.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization Condition="$(TargetFramework.Contains('-maccatalyst'))">true</InvariantGlobalization>
|
||||
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-ios'))">iossimulator-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
|
||||
<UseInterpreter Condition="$(TargetFramework.Contains('-android'))">False</UseInterpreter>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,60 @@
|
|||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="CommunityToolkit.Maui.Sample.MainPage"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels"
|
||||
x:Name="Page"
|
||||
Title="Welcome">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:MainViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<StackLayout>
|
||||
<ScrollView
|
||||
VerticalOptions="FillAndExpand">
|
||||
<StackLayout
|
||||
Spacing="16">
|
||||
<Label
|
||||
Margin="20,32,20,0"
|
||||
Style="{StaticResource label_welcome_header}"
|
||||
Text="Introducing the .NET MAUI Community Toolkit" />
|
||||
<Label
|
||||
Margin="20,0,20,28"
|
||||
Text="The .NET MAUI Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with .NET MAUI. It simplifies and demonstrates common developer tasks building iOS, Android, macOS and Windows apps with .NET MAUI." />
|
||||
<StackLayout
|
||||
BindableLayout.ItemsSource="{Binding Items}"
|
||||
Margin="6, 12, 6, 0">
|
||||
<BindableLayout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame
|
||||
Style="{StaticResource card}"
|
||||
Margin="0, 0, 0, 6">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding NavigateCommand, Source={x:Reference Page}}"
|
||||
CommandParameter="{Binding .}" />
|
||||
</Frame.GestureRecognizers>
|
||||
<Grid
|
||||
RowSpacing="0"
|
||||
RowDefinitions="Auto, *">
|
||||
<Label
|
||||
Text="{Binding Title}"
|
||||
Style="{StaticResource label_section_header}"/>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="{Binding Description}"/>
|
||||
</Grid>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</BindableLayout.ItemTemplate>
|
||||
</StackLayout>
|
||||
<Label
|
||||
Margin="0,32"
|
||||
FontSize="Small"
|
||||
HorizontalOptions="Center"
|
||||
Text="Microsoft Corporation 2021"
|
||||
VerticalOptions="End" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</StackLayout>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,12 @@
|
|||
using CommunityToolkit.Maui.Sample.Pages;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
public partial class MainPage : BasePage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.Maui.Graphics;
|
||||
using System;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.Models
|
||||
{
|
||||
public sealed class SectionModel
|
||||
{
|
||||
public SectionModel(Type type, string title, string description)
|
||||
: this(type, title, null, description)
|
||||
{
|
||||
}
|
||||
|
||||
public SectionModel(Type type, string title, Color color, string description)
|
||||
{
|
||||
Type = type;
|
||||
Title = title;
|
||||
Description = description;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
public Type Type { get; }
|
||||
|
||||
public string Title { get; }
|
||||
|
||||
public string Description { get; }
|
||||
|
||||
public Color Color { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.Pages
|
||||
{
|
||||
public class BaseNavigationPage : NavigationPage
|
||||
{
|
||||
public BaseNavigationPage(Page page) : base(page)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
using CommunityToolkit.Maui.Sample.Models;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
using System;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.Pages
|
||||
{
|
||||
public class BasePage : ContentPage, IPage
|
||||
{
|
||||
public BasePage()
|
||||
{
|
||||
NavigateCommand = new Command(async (parameter) =>
|
||||
{
|
||||
if (parameter != null)
|
||||
{
|
||||
await Navigation.PushAsync(PreparePage(parameter));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
Debug.WriteLine($"OnAppearing: {this}");
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
Debug.WriteLine($"OnDisappearing: {this}");
|
||||
}
|
||||
|
||||
public ICommand NavigateCommand { get; }
|
||||
|
||||
Page PreparePage(object parameter)
|
||||
{
|
||||
SectionModel model = parameter as SectionModel;
|
||||
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
var page = (Page)Activator.CreateInstance(model.Type);
|
||||
page.Title = model.Title;
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.BehaviorsGalleryPage"
|
||||
x:Name="Page"
|
||||
Title="Behaviors">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:BehaviorsGalleryViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<StackLayout>
|
||||
<ScrollView
|
||||
VerticalOptions="FillAndExpand">
|
||||
<StackLayout
|
||||
Spacing="16">
|
||||
<StackLayout
|
||||
BindableLayout.ItemsSource="{Binding Items}"
|
||||
Margin="6, 12, 6, 0">
|
||||
<BindableLayout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame
|
||||
Style="{StaticResource card}"
|
||||
Margin="0, 0, 0, 6">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding NavigateCommand, Source={x:Reference Page}}"
|
||||
CommandParameter="{Binding .}" />
|
||||
</Frame.GestureRecognizers>
|
||||
<Grid
|
||||
RowSpacing="0"
|
||||
RowDefinitions="Auto, *">
|
||||
<Label
|
||||
Text="{Binding Title}"
|
||||
Style="{StaticResource label_section_header}"/>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="{Binding Description}"/>
|
||||
</Grid>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</BindableLayout.ItemTemplate>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</StackLayout>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class BehaviorsGalleryPage : BasePage
|
||||
{
|
||||
public BehaviorsGalleryPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.EventToCommandBehaviorPage">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:EventToCommandBehaviorViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<ContentView Padding="{StaticResource ContentPadding}">
|
||||
<StackLayout VerticalOptions="CenterAndExpand"
|
||||
Spacing="20">
|
||||
<Label Text="This sample demonstrates how to use EventToCommandBehavior. Here we observe Clicked event of the button and trigger IncrementCommand from ViewModel." />
|
||||
<Label Text="{Binding ClickCount, StringFormat='{0} clicks'}" />
|
||||
<Button Text="Click Me"
|
||||
TextColor="White"
|
||||
BackgroundColor="{StaticResource NormalButtonBackgroundColor}">
|
||||
<Button.Behaviors>
|
||||
<mct:EventToCommandBehavior
|
||||
EventName="Clicked"
|
||||
Command="{Binding IncrementCommand}" />
|
||||
</Button.Behaviors>
|
||||
</Button>
|
||||
</StackLayout>
|
||||
</ContentView>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class EventToCommandBehaviorPage : BasePage
|
||||
{
|
||||
public EventToCommandBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.MaskedBehaviorPage">
|
||||
<ScrollView>
|
||||
<StackLayout Padding="{StaticResource ContentPadding}" Spacing="5">
|
||||
|
||||
<Label Padding="10,10,10,50" Text="This sample demonstrates how to use MaskedBehavior" />
|
||||
|
||||
<Entry Keyboard="Numeric">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="XX-XX-XX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Sort code 'XX-XX-XX'" />
|
||||
|
||||
<Entry Keyboard="Numeric">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="AA-AA-AA" UnMaskedCharacter="A" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Sort code 'AA-AA-AA'" />
|
||||
|
||||
<Entry Keyboard="Numeric">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="XXXX XXXX XXXX XXXX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small">
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<Span Text="e.g. Credit Card Number 'XXXX XXXX XXXX XXXX'" />
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
|
||||
|
||||
<Entry Keyboard="Numeric" Placeholder="dd/mm/yyyy">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="XX/XX/XXXX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Date 'XX/XX/XXXX'" />
|
||||
|
||||
<Entry Keyboard="Numeric" Placeholder="hh:mm">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="XX:XX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small">
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<Span Text="e.g. Time 'XX:XX'" />
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
|
||||
|
||||
<Entry Keyboard="Numeric">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="XXX-XX-XXXX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Social Security Number 'XXX-XX-XXXX'" />
|
||||
|
||||
<Entry Keyboard="Numeric">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaskedBehavior Mask="(XXX) XXX-XXXX" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Phone Number '(XXX) XXX-XXXX'" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class MaskedBehaviorPage : BasePage
|
||||
{
|
||||
public MaskedBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.MaxLengthReachedBehaviorPage">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:MaxLengthReachedBehaviorViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<pages:BasePage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Spacing="20">
|
||||
|
||||
<Label Text="When the MaxLength on an Entry field has been reached, any configured EventHandler gets invoked and a Command gets Executed."
|
||||
Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
<!-- Settings -->
|
||||
<Frame Margin="{StaticResource ContentPadding}"
|
||||
CornerRadius="10">
|
||||
<Grid ColumnDefinitions="2*, *">
|
||||
<Label Text="MaxLength setting on Entry field"
|
||||
VerticalTextAlignment="Center" />
|
||||
<Entry x:Name="MaxLengthSetting"
|
||||
Text="6"
|
||||
Keyboard="Numeric"
|
||||
Grid.Column="1" />
|
||||
|
||||
<Label Text="Should dismiss keyboard automatically"
|
||||
VerticalTextAlignment="Center"
|
||||
Grid.Row="1" />
|
||||
<Switch x:Name="AutoDismissKeyboardSetting"
|
||||
HorizontalOptions="End"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" />
|
||||
</Grid>
|
||||
</Frame>
|
||||
|
||||
<!-- First Scenario -->
|
||||
<Label Text="When the MaxLength of the first Entry has been reached, the focus will be set to the next Entry field."
|
||||
Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
<Entry Placeholder="Start typing until MaxLength is reached..."
|
||||
MaxLength="{Binding Path=Text, Source={x:Reference MaxLengthSetting}}"
|
||||
Margin="{StaticResource ContentPadding}">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaxLengthReachedBehavior MaxLengthReached="MaxLengthReachedBehavior_MaxLengthReached"
|
||||
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
|
||||
<Entry x:Name="nextEntry"
|
||||
Placeholder="This Entry will then get focus..."
|
||||
Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
|
||||
<!-- Second Scenario -->
|
||||
<Label Text="When the MaxLength of this Entry is reached, a Command is executed. Below are all Command executions shown."
|
||||
Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
<Entry Placeholder="Start typing until MaxLength is reached..."
|
||||
MaxLength="{Binding Path=Text, Source={x:Reference MaxLengthSetting}}"
|
||||
Margin="{StaticResource ContentPadding}">
|
||||
<Entry.Behaviors>
|
||||
<mct:MaxLengthReachedBehavior Command="{Binding MaxLengthReachedCommand}"
|
||||
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
|
||||
</Entry.Behaviors>
|
||||
</Entry>
|
||||
|
||||
<Label Text="{Binding CommandExecutions}" Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,17 @@
|
|||
using CommunityToolkit.Maui.Behaviors;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class MaxLengthReachedBehaviorPage : BasePage
|
||||
{
|
||||
public MaxLengthReachedBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void MaxLengthReachedBehavior_MaxLengthReached(object? sender, MaxLengthReachedEventArgs e)
|
||||
{
|
||||
nextEntry.Focus();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.ProgressBarAnimationBehaviorPage">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:ProgressBarAnimationBehaviorViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<StackLayout Padding="{StaticResource ContentPadding}"
|
||||
Spacing="50"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
<ProgressBar>
|
||||
<ProgressBar.Behaviors>
|
||||
<mct:ProgressBarAnimationBehavior AnimateProgress="{Binding Progress}" />
|
||||
</ProgressBar.Behaviors>
|
||||
</ProgressBar>
|
||||
|
||||
<Button Text="Set to 0" Command="{Binding SetTo0Command}" />
|
||||
<Button Text="Set to 50" Command="{Binding SetTo50Command}" />
|
||||
<Button Text="Set to 100" Command="{Binding SetTo100Command}" />
|
||||
</StackLayout>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class ProgressBarAnimationBehaviorPage : BasePage
|
||||
{
|
||||
public ProgressBarAnimationBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.SetFocusOnEntryCompletedBehaviorPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="SetFocusOnEntryCompletedBehavior"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class SetFocusOnEntryCompletedBehaviorPage : BasePage
|
||||
{
|
||||
public SetFocusOnEntryCompletedBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.UserStoppedTypingBehaviorPage">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:UserStoppedTypingBehaviorViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout Spacing="20">
|
||||
|
||||
<Label Text="This behavior waits for the user to stop typing and then executes a Command. The waiting threshold is adjustable, as well as there is an option to dismiss the keyboard after the user has stopped typing."
|
||||
Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
<Frame Margin="{StaticResource ContentPadding}"
|
||||
CornerRadius="10">
|
||||
|
||||
<Grid ColumnDefinitions="2*, *">
|
||||
<Label Text="User stopped typing time threshold (in ms)"
|
||||
VerticalTextAlignment="Center" />
|
||||
<Entry x:Name="TimeThresholdSetting"
|
||||
Text="1000"
|
||||
Keyboard="Numeric"
|
||||
Grid.Column="1" />
|
||||
|
||||
<Label Text="Minimum length threshold (number of characters)"
|
||||
VerticalTextAlignment="Center"
|
||||
Grid.Row="1" />
|
||||
<Entry x:Name="MinimumLengthThresholdSetting"
|
||||
Text="0"
|
||||
Keyboard="Numeric"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" />
|
||||
|
||||
<Label Text="Should dismiss keyboard automatically"
|
||||
VerticalTextAlignment="Center"
|
||||
Grid.Row="2" />
|
||||
<Switch x:Name="AutoDismissKeyboardSetting"
|
||||
HorizontalOptions="End"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1" />
|
||||
</Grid>
|
||||
</Frame>
|
||||
|
||||
<SearchBar Placeholder="Start searching..." Margin="{StaticResource ContentPadding}">
|
||||
<SearchBar.Behaviors>
|
||||
<mct:UserStoppedTypingBehavior Command="{Binding SearchCommand}"
|
||||
StoppedTypingTimeThreshold="{Binding Path=Text, Source={x:Reference TimeThresholdSetting}}"
|
||||
MinimumLengthThreshold="{Binding Path=Text, Source={x:Reference MinimumLengthThresholdSetting}}"
|
||||
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
|
||||
</SearchBar.Behaviors>
|
||||
</SearchBar>
|
||||
|
||||
<Label Text="{Binding PerformedSearches}" Margin="{StaticResource ContentPadding}" />
|
||||
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors
|
||||
{
|
||||
public partial class UserStoppedTypingBehaviorPage : BasePage
|
||||
{
|
||||
public UserStoppedTypingBehaviorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.BoolToObjectConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="BoolToObjectConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class BoolToObjectConverterPage : BasePage
|
||||
{
|
||||
public BoolToObjectConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ColorsConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ColorsConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ColorsConverterPage : BasePage
|
||||
{
|
||||
public ColorsConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ConvertersGalleryPage"
|
||||
x:Name="Page"
|
||||
Title="Converters">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:ConvertersGalleryViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<StackLayout>
|
||||
<ScrollView
|
||||
VerticalOptions="FillAndExpand">
|
||||
<StackLayout
|
||||
Spacing="16">
|
||||
<StackLayout
|
||||
BindableLayout.ItemsSource="{Binding Items}"
|
||||
Margin="6, 12, 6, 0">
|
||||
<BindableLayout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame
|
||||
Style="{StaticResource card}"
|
||||
Margin="0, 0, 0, 6">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding NavigateCommand, Source={x:Reference Page}}"
|
||||
CommandParameter="{Binding .}" />
|
||||
</Frame.GestureRecognizers>
|
||||
<Grid
|
||||
RowSpacing="0"
|
||||
RowDefinitions="Auto, *">
|
||||
<Label
|
||||
Text="{Binding Title}"
|
||||
Style="{StaticResource label_section_header}"/>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="{Binding Description}"/>
|
||||
</Grid>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</BindableLayout.ItemTemplate>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</StackLayout>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ConvertersGalleryPage : BasePage
|
||||
{
|
||||
public ConvertersGalleryPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.DateTimeOffsetConverterPage">
|
||||
<pages:BasePage.BindingContext>
|
||||
<vm:DateTimeOffsetConverterViewModel />
|
||||
</pages:BasePage.BindingContext>
|
||||
<pages:BasePage.Resources>
|
||||
<ResourceDictionary>
|
||||
<mct:DateTimeOffsetConverter x:Key="DateTimeOffsetConverter" />
|
||||
</ResourceDictionary>
|
||||
</pages:BasePage.Resources>
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="The DatePicker bellow is bound to a Property of type DateTimeOffset."
|
||||
Margin="16"
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold" />
|
||||
|
||||
<DatePicker Date="{Binding TheDate, Converter={StaticResource DateTimeOffsetConverter}}"
|
||||
Margin="16"
|
||||
HorizontalOptions="Center" />
|
||||
|
||||
<Label Text="{Binding TheDate}"
|
||||
Margin="16"
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class DateTimeOffsetConverterPage : BasePage
|
||||
{
|
||||
public DateTimeOffsetConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.DoubleToIntConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="DoubleToIntConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class DoubleToIntConverterPage : BasePage
|
||||
{
|
||||
public DoubleToIntConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.EnumToBoolConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="EnumToBoolConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class EnumToBoolConverterPage : BasePage
|
||||
{
|
||||
public EnumToBoolConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.EnumToIntConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="EnumToIntConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class EnumToIntConverterPage : BasePage
|
||||
{
|
||||
public EnumToIntConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.EqualConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="EqualConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class EqualConverterPage : BasePage
|
||||
{
|
||||
public EqualConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ImageResourceConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ImageResourceConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ImageResourceConverterPage : BasePage
|
||||
{
|
||||
public ImageResourceConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.IndexToArrayItemConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="IndexToArrayItemConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class IndexToArrayItemConverterPage : BasePage
|
||||
{
|
||||
public IndexToArrayItemConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.IntToBoolConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="IntToBoolConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class IntToBoolConverterPage : BasePage
|
||||
{
|
||||
public IntToBoolConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.InvertedBoolConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="InvertedBoolConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class InvertedBoolConverterPage : BasePage
|
||||
{
|
||||
public InvertedBoolConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.IsNotNullOrEmptyConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="IsNotNullOrEmptyConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class IsNotNullOrEmptyConverterPage : BasePage
|
||||
{
|
||||
public IsNotNullOrEmptyConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.IsNullOrEmptyConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="IsNullOrEmptyConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class IsNullOrEmptyConverterPage : BasePage
|
||||
{
|
||||
public IsNullOrEmptyConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ItemTappedEventArgsPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ItemTappedEventArgs"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ItemTappedEventArgsPage : BasePage
|
||||
{
|
||||
public ItemTappedEventArgsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ListIsNotNullOrEmptyConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ListIsNotNullOrEmptyConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ListIsNotNullOrEmptyConverterPage : BasePage
|
||||
{
|
||||
public ListIsNotNullOrEmptyConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ListIsNullOrEmptyPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ListIsNotNullOrEmptyConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ListIsNullOrEmptyPage : BasePage
|
||||
{
|
||||
public ListIsNullOrEmptyPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ListToStringConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="ListToStringConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class ListToStringConverterPage : BasePage
|
||||
{
|
||||
public ListToStringConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.MathExpressionConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="MathExpressionConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class MathExpressionConverterPage : BasePage
|
||||
{
|
||||
public MathExpressionConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.MultiConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="MultiConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class MultiConverterPage : BasePage
|
||||
{
|
||||
public MultiConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.NotEqualConverterPage">
|
||||
<pages:BasePage.Resources>
|
||||
<ResourceDictionary>
|
||||
<mct:NotEqualConverter x:Key="NotEqualConverter" />
|
||||
</ResourceDictionary>
|
||||
</pages:BasePage.Resources>
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout
|
||||
Padding="10,10"
|
||||
HorizontalOptions="Fill"
|
||||
Spacing="10"
|
||||
VerticalOptions="Fill">
|
||||
<Label Text="The NotEqualConverter is a converter that allows users to convert any value binding to a boolean depending on whether or not it is equal to a different value. The initial binding contains the object that will be compared and the ConverterParameter contains the object to compare it to." TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Label Text="Please enter 100 for true anyting else for false" TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Entry
|
||||
x:Name="ExampleText"
|
||||
Placeholder="100 for false other for true"
|
||||
Text="{Binding Input}"
|
||||
TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Label
|
||||
Padding="7,0,0,0"
|
||||
BindingContext="{x:Reference Name=ExampleText}"
|
||||
Text="{Binding Path=Text, Converter={StaticResource NotEqualConverter}, ConverterParameter=100}"
|
||||
TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class NotEqualConverterPage : BasePage
|
||||
{
|
||||
public NotEqualConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.StringToListConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="StringToListConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class StringToListConverterPage : BasePage
|
||||
{
|
||||
public StringToListConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.TextCaseConverterPage">
|
||||
<pages:BasePage.Resources>
|
||||
<ResourceDictionary>
|
||||
<mct:TextCaseConverter x:Key="TextCaseConverter" Type="Upper" />
|
||||
</ResourceDictionary>
|
||||
</pages:BasePage.Resources>
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout
|
||||
Padding="10,10"
|
||||
HorizontalOptions="Fill"
|
||||
Spacing="10"
|
||||
VerticalOptions="Fill">
|
||||
<Label Text="The TextCaseConverter is a converter that allows users to convert the casing of an incoming string type binding. The Type property is used to define what kind of casing will be applied to the string." TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Label Text="The Entered Text will be converted to upper case" TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Entry
|
||||
x:Name="ExampleText"
|
||||
Placeholder="Enter text here"
|
||||
Text="{Binding Input}"
|
||||
TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
<Label
|
||||
Padding="7,0,0,0"
|
||||
BindingContext="{x:Reference Name=ExampleText}"
|
||||
Text="{Binding Path=Text, Converter={StaticResource TextCaseConverter}}"
|
||||
TextColor="{StaticResource NormalLabelTextColor}" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class TextCaseConverterPage : BasePage
|
||||
{
|
||||
public TextCaseConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:BasePage
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
|
||||
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
|
||||
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.VariableMultiValueConverterPage">
|
||||
<pages:BasePage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="VariableMultiValueConverter"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</pages:BasePage.Content>
|
||||
</pages:BasePage>
|
|
@ -0,0 +1,10 @@
|
|||
namespace CommunityToolkit.Maui.Sample.Pages.Converters
|
||||
{
|
||||
public partial class VariableMultiValueConverterPage : BasePage
|
||||
{
|
||||
public VariableMultiValueConverterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
|
||||
<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" />
|
||||
</manifest>
|
|
@ -0,0 +1,14 @@
|
|||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Microsoft.Maui;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
[Activity(
|
||||
Theme = "@style/Maui.SplashTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Android.App;
|
||||
using Android.Runtime;
|
||||
using Microsoft.Maui;
|
||||
using System;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication<Startup>
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
</resources>
|
|
@ -0,0 +1,10 @@
|
|||
using Foundation;
|
||||
using Microsoft.Maui;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate<Startup>
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.15</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/appicon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,15 @@
|
|||
using UIKit;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
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, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using Foundation;
|
||||
using Microsoft.Maui;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate<Startup>
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.3.4</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/appicon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,15 @@
|
|||
using UIKit;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
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, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" />
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" />
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" />
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" />
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2017 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines"
|
||||
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
|
||||
<rect key="frame" x="20" y="439" width="441" height="21" />
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17" />
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
|
||||
<nil key="highlightedColor" />
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sample.iOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
|
||||
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43" />
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" />
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
|
||||
<nil key="highlightedColor" />
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
<constraints>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" />
|
||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" />
|
||||
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" />
|
||||
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" />
|
||||
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" />
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" />
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics" />
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" />
|
||||
<point key="canvasLocation" x="548" y="455" />
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
Двоичные данные
samples/CommunityToolkit.Maui.Sample/Resources/Fonts/OpenSans-Regular.ttf
Normal file
Двоичные данные
samples/CommunityToolkit.Maui.Sample/Resources/Fonts/OpenSans-Regular.ttf
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,93 @@
|
|||
<svg width="419" height="519" viewBox="0 0 419 519" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M284.432 247.568L284.004 221.881C316.359 221.335 340.356 211.735 355.308 193.336C382.408 159.996 372.893 108.183 372.786 107.659L398.013 102.831C398.505 105.432 409.797 167.017 375.237 209.53C355.276 234.093 324.719 246.894 284.432 247.568Z" fill="#8A6FE8"/>
|
||||
<path d="M331.954 109.36L361.826 134.245C367.145 138.676 375.055 137.959 379.497 132.639C383.928 127.32 383.211 119.41 377.891 114.969L348.019 90.0842C342.7 85.6531 334.79 86.3702 330.348 91.6896C325.917 97.0197 326.634 104.929 331.954 109.36Z" fill="#8A6FE8"/>
|
||||
<path d="M407.175 118.062L417.92 94.2263C420.735 87.858 417.856 80.4087 411.488 77.5831C405.12 74.7682 397.67 77.6473 394.845 84.0156L383.831 108.461L407.175 118.062Z" fill="#8A6FE8"/>
|
||||
<path d="M401.363 105.175L401.234 69.117C401.181 62.1493 395.498 56.541 388.53 56.5945C381.562 56.648 375.954 62.3313 376.007 69.2989L376.018 96.11L401.363 105.175Z" fill="#8A6FE8"/>
|
||||
<path d="M386.453 109.071L378.137 73.9548C376.543 67.169 369.757 62.9628 362.971 64.5575C356.185 66.1523 351.979 72.938 353.574 79.7237L362.04 115.482L386.453 109.071Z" fill="#8A6FE8"/>
|
||||
<path d="M381.776 142.261C396.359 142.261 408.181 130.44 408.181 115.857C408.181 101.274 396.359 89.4527 381.776 89.4527C367.194 89.4527 355.372 101.274 355.372 115.857C355.372 130.44 367.194 142.261 381.776 142.261Z" fill="url(#paint0_radial)"/>
|
||||
<path d="M248.267 406.979C248.513 384.727 245.345 339.561 222.376 301.736L199.922 315.372C220.76 349.675 222.323 389.715 221.841 407.182C221.798 408.627 235.263 409.933 248.267 406.979Z" fill="url(#paint1_linear)"/>
|
||||
<path d="M221.841 406.936L242.637 406.84L262.052 518.065L220.311 518.258C217.132 518.269 214.724 515.711 214.938 512.532L221.841 406.936Z" fill="#522CD5"/>
|
||||
<path d="M306.566 488.814C310.173 491.661 310.109 495.782 309.831 500.127L308.964 513.452C308.803 515.839 306.727 517.798 304.34 517.809L260.832 518.012C258.125 518.023 256.08 515.839 256.262 513.142L256.551 499.335C256.883 494.315 255.192 492.474 251.307 487.744C244.649 479.663 224.967 435.62 226.84 406.925L248.256 406.829C249.691 423.858 272.167 461.682 306.566 488.814Z" fill="url(#paint2_linear)"/>
|
||||
<path d="M309.82 500.127C310.023 497.088 310.077 494.176 308.889 491.715L254.635 491.961C256.134 494.166 256.765 496.092 256.562 499.314L256.273 513.121C256.091 515.828 258.146 518.012 260.843 517.99L304.34 517.798C306.727 517.787 308.803 515.828 308.964 513.442L309.82 500.127Z" fill="url(#paint3_radial)"/>
|
||||
<path d="M133.552 407.471C133.103 385.22 135.864 340.021 158.49 301.993L181.073 315.425C160.545 349.921 159.346 389.972 159.989 407.428C160.042 408.884 146.578 410.318 133.552 407.471Z" fill="url(#paint4_linear)"/>
|
||||
<path d="M110.798 497.152C110.765 494.187 111.204 491.575 112.457 487.23C131.882 434.132 133.52 407.364 133.52 407.364L159.999 407.246C159.999 407.246 161.819 433.512 181.716 486.427C183.289 490.195 183.471 493.641 183.674 496.831L183.792 513.816C183.803 516.374 181.716 518.483 179.158 518.494L177.873 518.504L116.781 518.782L115.496 518.793C112.927 518.804 110.83 516.728 110.819 514.159L110.798 497.152Z" fill="url(#paint5_linear)"/>
|
||||
<path d="M110.798 497.152C110.798 496.67 110.808 496.199 110.83 495.739C110.969 494.262 111.643 492.603 114.875 492.582L180.207 492.282C182.561 492.367 183.343 494.176 183.589 495.311C183.621 495.814 183.664 496.328 183.696 496.82L183.813 513.806C183.824 515.411 183.011 516.824 181.769 517.669C181.031 518.172 180.132 518.472 179.179 518.483L177.895 518.494L116.802 518.772L115.528 518.782C114.244 518.793 113.077 518.269 112.232 517.434C111.386 516.599 110.862 515.432 110.851 514.148L110.798 497.152Z" fill="url(#paint6_radial)"/>
|
||||
<path d="M314.979 246.348C324.162 210.407 318.008 181.777 318.008 181.777L326.452 181.734L326.656 181.574C314.262 115.75 256.326 66.0987 186.949 66.4198C108.796 66.773 45.7233 130.424 46.0765 208.577C46.4297 286.731 110.08 349.803 188.234 349.45C249.905 349.172 302.178 309.474 321.304 254.343C321.872 251.999 321.797 247.804 314.979 246.348Z" fill="url(#paint7_radial)"/>
|
||||
<path d="M310.237 279.035L65.877 280.148C71.3998 289.428 77.95 298.012 85.3672 305.761L290.972 304.829C298.336 297.005 304.8 288.368 310.237 279.035Z" fill="#D8CFF7"/>
|
||||
<path d="M235.062 312.794L280.924 312.585L280.74 272.021L234.877 272.23L235.062 312.794Z" fill="#512BD4"/>
|
||||
<path d="M243.001 297.626C242.691 297.626 242.434 297.53 242.22 297.327C242.006 297.123 241.899 296.866 241.899 296.588C241.899 296.299 242.006 296.042 242.22 295.839C242.434 295.625 242.691 295.528 243.001 295.528C243.312 295.528 243.568 295.635 243.782 295.839C243.996 296.042 244.114 296.299 244.114 296.588C244.114 296.877 244.007 297.123 243.793 297.327C243.568 297.519 243.312 297.626 243.001 297.626Z" fill="white"/>
|
||||
<path d="M255.192 297.434H253.212L247.967 289.203C247.839 289 247.721 288.775 247.636 288.55H247.593C247.636 288.786 247.657 289.299 247.657 290.091L247.668 297.444H245.912L245.891 286.228H247.999L253.062 294.265C253.276 294.597 253.415 294.833 253.479 294.95H253.511C253.458 294.651 253.437 294.148 253.437 293.441L253.426 286.217H255.17L255.192 297.434Z" fill="white"/>
|
||||
<path d="M263.733 297.412L257.589 297.423L257.568 286.206L263.465 286.195V287.779L259.387 287.79L259.398 290.969L263.155 290.958V292.532L259.398 292.542L259.409 295.86L263.733 295.85V297.412Z" fill="white"/>
|
||||
<path d="M272.445 287.758L269.298 287.769L269.32 297.401H267.5L267.479 287.769L264.343 287.779V286.195L272.434 286.174L272.445 287.758Z" fill="white"/>
|
||||
<path d="M315.279 246.337C324.355 210.836 318.457 182.483 318.308 181.798L171.484 182.462C171.484 182.462 162.226 181.563 162.268 190.018C162.311 198.463 162.761 222.341 162.878 248.746C162.9 254.172 167.363 256.773 170.863 256.751C170.874 256.751 311.618 252.213 315.279 246.337Z" fill="url(#paint8_radial)"/>
|
||||
<path d="M227.685 246.798C227.685 246.798 250.183 228.827 254.571 225.499C258.959 222.17 262.812 221.977 266.869 225.445C270.925 228.913 293.616 246.498 293.616 246.498L227.685 246.798Z" fill="#A08BE8"/>
|
||||
<path d="M320.748 256.141C320.748 256.141 324.943 248.414 315.279 246.348C315.289 246.305 170.927 246.894 170.927 246.894C167.566 246.905 163.232 244.925 162.846 241.671C162.857 244.004 162.878 246.369 162.889 248.756C162.91 253.68 166.582 256.27 169.878 256.698C170.21 256.73 170.542 256.773 170.874 256.773L180.742 256.73L320.748 256.141Z" fill="#512BD4"/>
|
||||
<path d="M206.4 233.214C212.511 233.095 217.302 224.667 217.102 214.39C216.901 204.112 211.785 195.878 205.674 195.997C199.563 196.116 194.772 204.544 194.973 214.821C195.173 225.099 200.289 233.333 206.4 233.214Z" fill="#512BD4"/>
|
||||
<path d="M306.249 214.267C306.356 203.989 301.488 195.605 295.377 195.541C289.266 195.478 284.225 203.758 284.118 214.037C284.011 224.315 288.878 232.699 294.99 232.763C301.101 232.826 306.142 224.545 306.249 214.267Z" fill="#512BD4"/>
|
||||
<path d="M205.905 205.291C208.152 203.022 211.192 202.016 214.157 202.262C215.912 205.495 217.014 209.733 217.111 214.389C217.164 217.3 216.811 220.04 216.158 222.513C212.669 223.519 208.752 222.662 205.979 219.922C201.912 215.909 201.88 209.348 205.905 205.291Z" fill="#8065E0"/>
|
||||
<path d="M294.996 204.285C297.255 202.016 300.294 200.999 303.259 201.256C305.164 204.628 306.309 209.209 306.256 214.239C306.224 216.808 305.892 219.259 305.303 221.485C301.793 222.523 297.843 221.678 295.061 218.916C291.004 214.892 290.972 208.342 294.996 204.285Z" fill="#8065E0"/>
|
||||
<path d="M11.6342 357.017C10.9171 354.716 -5.72611 300.141 21.3204 258.903C36.9468 235.078 63.3083 221.035 99.6664 217.15L102.449 243.276C74.3431 246.273 54.4676 256.345 43.3579 273.202C23.0971 303.941 36.5722 348.733 36.7113 349.183L11.6342 357.017Z" fill="url(#paint9_linear)"/>
|
||||
<path d="M95.1498 252.802C109.502 252.802 121.137 241.167 121.137 226.815C121.137 212.463 109.502 200.828 95.1498 200.828C80.7976 200.828 69.1628 212.463 69.1628 226.815C69.1628 241.167 80.7976 252.802 95.1498 252.802Z" fill="url(#paint10_radial)"/>
|
||||
<path d="M72.0098 334.434L33.4683 329.307C26.597 328.397 20.2929 333.214 19.3725 340.085C18.4627 346.956 23.279 353.26 30.1504 354.181L68.6919 359.308C75.5632 360.217 81.8673 355.401 82.7878 348.53C83.6975 341.658 78.8705 335.344 72.0098 334.434Z" fill="#8A6FE8"/>
|
||||
<path d="M3.73535 367.185L7.35297 393.076C8.36975 399.968 14.7702 404.731 21.6629 403.725C28.5556 402.708 33.3185 396.308 32.3124 389.415L28.5984 362.861L3.73535 367.185Z" fill="#8A6FE8"/>
|
||||
<path d="M15.5194 374.988L34.849 405.427C38.6058 411.292 46.4082 413.005 52.2735 409.248C58.1387 405.491 59.8512 397.689 56.0945 391.823L41.7953 369.144L15.5194 374.988Z" fill="#8A6FE8"/>
|
||||
<path d="M26.0511 363.739L51.8026 389.019C56.7688 393.911 64.7532 393.846 69.6445 388.88C74.5358 383.914 74.4715 375.929 69.516 371.038L43.2937 345.297L26.0511 363.739Z" fill="#8A6FE8"/>
|
||||
<path d="M26.4043 381.912C40.987 381.912 52.8086 370.091 52.8086 355.508C52.8086 340.925 40.987 329.104 26.4043 329.104C11.8216 329.104 0 340.925 0 355.508C0 370.091 11.8216 381.912 26.4043 381.912Z" fill="url(#paint11_radial)"/>
|
||||
<path d="M184.73 63.6308L157.819 66.5892L158.561 38.5412L177.888 36.4178L184.73 63.6308Z" fill="#8A6FE8"/>
|
||||
<path d="M170.018 41.647C180.455 39.521 187.193 29.3363 185.067 18.8988C182.941 8.46126 172.757 1.72345 162.319 3.84944C151.882 5.97543 145.144 16.1601 147.27 26.5976C149.396 37.0351 159.58 43.773 170.018 41.647Z" fill="#D8CFF7"/>
|
||||
<path d="M196.885 79.385C198.102 79.2464 198.948 78.091 198.684 76.8997C195.851 64.2818 183.923 55.5375 170.773 56.9926C157.622 58.4371 147.886 69.5735 147.865 82.4995C147.863 83.7232 148.949 84.6597 150.168 84.5316L196.885 79.385Z" fill="url(#paint12_radial)"/>
|
||||
<defs>
|
||||
<radialGradient id="paint0_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(382.004 103.457) scale(26.4058)">
|
||||
<stop stop-color="#8065E0"/>
|
||||
<stop offset="1" stop-color="#512BD4"/>
|
||||
</radialGradient>
|
||||
<linearGradient id="paint1_linear" x1="214.439" y1="303.482" x2="236.702" y2="409.505" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#522CD5"/>
|
||||
<stop offset="0.4397" stop-color="#8A6FE8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear" x1="231.673" y1="404.144" x2="297.805" y2="522.048" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#522CD5"/>
|
||||
<stop offset="0.4397" stop-color="#8A6FE8"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="paint3_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(280.957 469.555) rotate(-0.260742) scale(45.8326)">
|
||||
<stop offset="0.034" stop-color="#522CD5"/>
|
||||
<stop offset="0.9955" stop-color="#8A6FE8"/>
|
||||
</radialGradient>
|
||||
<linearGradient id="paint4_linear" x1="166.061" y1="303.491" x2="144.763" y2="409.709" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#522CD5"/>
|
||||
<stop offset="0.4397" stop-color="#8A6FE8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint5_linear" x1="146.739" y1="407.302" x2="147.246" y2="518.627" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#522CD5"/>
|
||||
<stop offset="0.4397" stop-color="#8A6FE8"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="paint6_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(148.63 470.023) rotate(179.739) scale(50.2476)">
|
||||
<stop offset="0.034" stop-color="#522CD5"/>
|
||||
<stop offset="0.9955" stop-color="#8A6FE8"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint7_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(219.219 153.929) rotate(179.739) scale(140.935)">
|
||||
<stop offset="0.4744" stop-color="#A08BE8"/>
|
||||
<stop offset="0.8618" stop-color="#8065E0"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint8_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(314.861 158.738) rotate(179.739) scale(146.053)">
|
||||
<stop offset="0.0933" stop-color="#E1DFDD"/>
|
||||
<stop offset="0.6573" stop-color="white"/>
|
||||
</radialGradient>
|
||||
<linearGradient id="paint9_linear" x1="54.1846" y1="217.159" x2="54.1846" y2="357.022" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.3344" stop-color="#9780E6"/>
|
||||
<stop offset="0.8488" stop-color="#8A6FE8"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="paint10_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(90.3494 218.071) rotate(-0.260742) scale(25.9924)">
|
||||
<stop stop-color="#8065E0"/>
|
||||
<stop offset="1" stop-color="#512BD4"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint11_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(25.805 345.043) scale(26.4106)">
|
||||
<stop stop-color="#8065E0"/>
|
||||
<stop offset="1" stop-color="#512BD4"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint12_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(169.113 67.3662) rotate(-32.2025) scale(21.0773)">
|
||||
<stop stop-color="#8065E0"/>
|
||||
<stop offset="1" stop-color="#512BD4"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 12 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="456" height="456" fill="#512BD4" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 228 B |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.8 KiB |
|
@ -0,0 +1,19 @@
|
|||
using Microsoft.Maui;
|
||||
using Microsoft.Maui.Controls.Compatibility;
|
||||
using Microsoft.Maui.Controls.Hosting;
|
||||
using Microsoft.Maui.Controls.Xaml;
|
||||
using Microsoft.Maui.Hosting;
|
||||
|
||||
[assembly: XamlCompilationAttribute(XamlCompilationOptions.Compile)]
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample
|
||||
{
|
||||
public class Startup : IStartup
|
||||
{
|
||||
public void Configure(IAppHostBuilder appBuilder)
|
||||
{
|
||||
appBuilder
|
||||
.UseMauiApp<App>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using CommunityToolkit.Maui.Sample.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels
|
||||
{
|
||||
public abstract class BaseGalleryViewModel : BaseViewModel
|
||||
{
|
||||
string _filterValue;
|
||||
|
||||
public BaseGalleryViewModel()
|
||||
{
|
||||
var items = CreateItems();
|
||||
|
||||
if (items != null)
|
||||
Items = items.ToList();
|
||||
|
||||
Filter();
|
||||
}
|
||||
|
||||
public IReadOnlyList<SectionModel> Items { get; }
|
||||
|
||||
public string FilterValue
|
||||
{
|
||||
get { return _filterValue; }
|
||||
set
|
||||
{
|
||||
_filterValue = value;
|
||||
Filter();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<SectionModel> FilteredItems { get; private set; } = Enumerable.Empty<SectionModel>();
|
||||
|
||||
protected abstract IEnumerable<SectionModel> CreateItems();
|
||||
|
||||
void Filter()
|
||||
{
|
||||
FilterValue ??= string.Empty;
|
||||
FilteredItems = string.IsNullOrEmpty(FilterValue) ? Items : Items.Where(item => item.Title.IndexOf(FilterValue, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||
OnPropertyChanged(nameof(FilteredItems));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels
|
||||
{
|
||||
public abstract class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
protected bool SetProperty<T>(ref T backingStore, T value,
|
||||
[CallerMemberName] string propertyName = "",
|
||||
Action onChanged = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(backingStore, value))
|
||||
return false;
|
||||
|
||||
backingStore = value;
|
||||
onChanged?.Invoke();
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using CommunityToolkit.Maui.Behaviors;
|
||||
using CommunityToolkit.Maui.Sample.Models;
|
||||
using CommunityToolkit.Maui.Sample.Pages.Behaviors;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors
|
||||
{
|
||||
public class BehaviorsGalleryViewModel : BaseGalleryViewModel
|
||||
{
|
||||
protected override IEnumerable<SectionModel> CreateItems() => new[]
|
||||
{
|
||||
new SectionModel(
|
||||
typeof(EventToCommandBehaviorPage),
|
||||
nameof(EventToCommandBehavior),
|
||||
"Turns any event into a command that can be bound to"),
|
||||
new SectionModel(
|
||||
typeof(MaskedBehaviorPage),
|
||||
nameof(MaskedBehavior),
|
||||
"Masked text in entry with specific pattern"),
|
||||
new SectionModel(
|
||||
typeof(UserStoppedTypingBehaviorPage),
|
||||
nameof(UserStoppedTypingBehavior),
|
||||
"This behavior waits for the user to stop typing and then executes a Command"),
|
||||
new SectionModel(
|
||||
typeof(MaxLengthReachedBehaviorPage),
|
||||
nameof(MaxLengthReachedBehavior),
|
||||
"This behavior invokes an EventHandler and executes a Command when the MaxLength of an InputView has been reached"),
|
||||
new SectionModel(
|
||||
typeof(ProgressBarAnimationBehaviorPage),
|
||||
nameof(ProgressBarAnimationBehavior),
|
||||
"Animate the progress for the ProgressBar"),
|
||||
new SectionModel(
|
||||
typeof(SetFocusOnEntryCompletedBehaviorPage),
|
||||
nameof(SetFocusOnEntryCompletedBehavior),
|
||||
"Set focus to another element when an entry is completed"),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using Microsoft.Maui.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors
|
||||
{
|
||||
public class EventToCommandBehaviorViewModel : BaseViewModel
|
||||
{
|
||||
int clickCount;
|
||||
|
||||
public EventToCommandBehaviorViewModel()
|
||||
{
|
||||
IncrementCommand = new Command(() => ClickCount++);
|
||||
}
|
||||
|
||||
public int ClickCount
|
||||
{
|
||||
get => clickCount;
|
||||
set => SetProperty(ref clickCount, value);
|
||||
}
|
||||
|
||||
public ICommand IncrementCommand { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.Maui.Controls;
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors
|
||||
{
|
||||
public class MaxLengthReachedBehaviorViewModel : BaseViewModel
|
||||
{
|
||||
string commandExecutions = string.Empty;
|
||||
|
||||
public string CommandExecutions
|
||||
{
|
||||
get => commandExecutions;
|
||||
set => SetProperty(ref commandExecutions, value);
|
||||
}
|
||||
|
||||
public ICommand MaxLengthReachedCommand { get; }
|
||||
|
||||
public MaxLengthReachedBehaviorViewModel()
|
||||
=> MaxLengthReachedCommand = new Command<string>(OnCommandExecuted);
|
||||
|
||||
void OnCommandExecuted(string text)
|
||||
=> CommandExecutions += string.Format("MaxLength reached with value: '{0}'.", text) + Environment.NewLine;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using Microsoft.Maui.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors
|
||||
{
|
||||
public class ProgressBarAnimationBehaviorViewModel : BaseViewModel
|
||||
{
|
||||
double progress;
|
||||
|
||||
public ProgressBarAnimationBehaviorViewModel()
|
||||
{
|
||||
SetTo0Command = new Command(() => SetProgress(0));
|
||||
SetTo50Command = new Command(() => SetProgress(0.5));
|
||||
SetTo100Command = new Command(() => SetProgress(1));
|
||||
}
|
||||
|
||||
public ICommand SetTo0Command { get; }
|
||||
|
||||
public ICommand SetTo50Command { get; }
|
||||
|
||||
public ICommand SetTo100Command { get; }
|
||||
|
||||
public double Progress
|
||||
{
|
||||
get => progress;
|
||||
set => SetProperty(ref progress, value);
|
||||
}
|
||||
|
||||
void SetProgress(double progress) => Progress = progress;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.Maui.Controls;
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors
|
||||
{
|
||||
public class UserStoppedTypingBehaviorViewModel : BaseViewModel
|
||||
{
|
||||
string performedSearches = string.Empty;
|
||||
|
||||
public string PerformedSearches
|
||||
{
|
||||
get => performedSearches;
|
||||
set => SetProperty(ref performedSearches, value);
|
||||
}
|
||||
|
||||
public ICommand SearchCommand { get; }
|
||||
|
||||
public UserStoppedTypingBehaviorViewModel()
|
||||
=> SearchCommand = new Command<string>(PerformSearch);
|
||||
|
||||
void PerformSearch(string searchTerms)
|
||||
=> PerformedSearches += string.Format("Performed search for '{0}'.", searchTerms) + Environment.NewLine;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
using CommunityToolkit.Maui.Converters;
|
||||
using CommunityToolkit.Maui.Sample.Models;
|
||||
using CommunityToolkit.Maui.Sample.Pages.Converters;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Converters
|
||||
{
|
||||
public class ConvertersGalleryViewModel : BaseGalleryViewModel
|
||||
{
|
||||
protected override IEnumerable<SectionModel> CreateItems() => new[]
|
||||
{
|
||||
new SectionModel(
|
||||
typeof(BoolToObjectConverterPage),
|
||||
nameof(BoolToObjectConverter),
|
||||
"A converter that allows users to convert a bool value binding to a specific object."),
|
||||
new SectionModel(
|
||||
typeof(IsNullOrEmptyConverterPage),
|
||||
nameof(IsNullOrEmptyConverter),
|
||||
"A converter that allows users to convert an incoming binding to a bool value. This value represents if the incoming binding value is null or empty."),
|
||||
new SectionModel(
|
||||
typeof(IsNotNullOrEmptyConverterPage),
|
||||
nameof(IsNotNullOrEmptyConverter),
|
||||
"A converter that allows users to convert an incoming binding to a bool value. This value represents if the incoming binding value is Not null or empty."),
|
||||
new SectionModel(
|
||||
typeof(InvertedBoolConverterPage),
|
||||
nameof(InvertedBoolConverter),
|
||||
"A converter that allows users to convert a bool value binding to its inverted value.."),
|
||||
new SectionModel(
|
||||
typeof(EqualConverterPage),
|
||||
nameof(EqualConverter),
|
||||
"A converter that allows users to convert any value binding to a bool depending on whether or not it is equal to a different value. "),
|
||||
new SectionModel(
|
||||
typeof(NotEqualConverterPage),
|
||||
nameof(NotEqualConverter),
|
||||
"A converter that allows users to convert any value binding to a bool depending on whether or not it is not equal to a different value. "),
|
||||
new SectionModel(
|
||||
typeof(DoubleToIntConverterPage),
|
||||
nameof(DoubleToIntConverter),
|
||||
"A converter that allows users to convert an incoming double value to an int."),
|
||||
new SectionModel(
|
||||
typeof(IndexToArrayItemConverterPage),
|
||||
nameof(IndexToArrayItemConverter),
|
||||
"A converter that allows users to convert a int value binding to an item in an array."),
|
||||
new SectionModel(
|
||||
typeof(IntToBoolConverterPage),
|
||||
nameof(IntToBoolConverter),
|
||||
"A converter that allows users to convert an incoming int value to a bool."),
|
||||
new SectionModel(
|
||||
typeof(ItemTappedEventArgsPage),
|
||||
nameof(ItemTappedEventArgsConverter),
|
||||
"A converter that allows you to extract the value from ItemTappedEventArgs that can be used in combination with EventToCommandBehavior"),
|
||||
new SectionModel(
|
||||
typeof(TextCaseConverterPage),
|
||||
nameof(TextCaseConverter),
|
||||
"A converter that allows users to convert the casing of an incoming string type binding. The Type property is used to define what kind of casing will be applied to the string."),
|
||||
new SectionModel(
|
||||
typeof(MultiConverterPage),
|
||||
nameof(MultiConverter),
|
||||
"This sample demonstrates how to use Multibinding Converter"),
|
||||
new SectionModel(
|
||||
typeof(DateTimeOffsetConverterPage),
|
||||
nameof(DateTimeOffsetConverter),
|
||||
"A converter that allows to convert from a DateTimeOffset type to a DateTime type"),
|
||||
new SectionModel(
|
||||
typeof(VariableMultiValueConverterPage),
|
||||
nameof(VariableMultiValueConverter),
|
||||
"A converter that allows you to combine multiple boolean bindings into a single binding."),
|
||||
new SectionModel(
|
||||
typeof(ListIsNullOrEmptyPage),
|
||||
nameof(ListIsNullOrEmptyConverter),
|
||||
"A converter that allows you to check if collection is null or empty"),
|
||||
new SectionModel(
|
||||
typeof(ListIsNotNullOrEmptyConverterPage),
|
||||
nameof(ListIsNotNullOrEmptyConverter),
|
||||
"A converter that allows you to check if collection is not null or empty"),
|
||||
new SectionModel(
|
||||
typeof(ListToStringConverterPage),
|
||||
nameof(ListToStringConverter),
|
||||
"A converter that allows users to convert an incoming binding that implements IEnumerable to a single string value. The Separator property is used to join the items in the IEnumerable."),
|
||||
new SectionModel(
|
||||
typeof(EnumToBoolConverterPage),
|
||||
nameof(EnumToBoolConverter),
|
||||
"A converter that allows you to convert an Enum to boolean value"),
|
||||
new SectionModel(
|
||||
typeof(EnumToIntConverterPage),
|
||||
nameof(EnumToIntConverter),
|
||||
"A converter that allows you to convert an Enum to its underlying int value"),
|
||||
new SectionModel(
|
||||
typeof(ImageResourceConverterPage),
|
||||
nameof(ImageResourceConverter),
|
||||
"A converter that allows you to convert embeded ressource image id to an ImageSource"),
|
||||
new SectionModel(
|
||||
typeof(MathExpressionConverterPage),
|
||||
nameof(MathExpressionConverter),
|
||||
"A converter that allows users to calculate an expression at runtime."),
|
||||
new SectionModel(
|
||||
typeof(StringToListConverterPage),
|
||||
nameof(StringToListConverter),
|
||||
"A converter that splits a string by the separator and returns the enumerable sequence of strings as the result."),
|
||||
new SectionModel(
|
||||
typeof(ImageResourceConverterPage),
|
||||
nameof(ImageResourceConverter),
|
||||
"A converter that allows you to convert embeded ressource image id to an ImageSource"),
|
||||
new SectionModel(
|
||||
typeof(ColorsConverterPage),
|
||||
"Colors converters",
|
||||
"A group of converters that convert a Color to your strings values (RGB, HEX, HSL, etc)"),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels.Converters
|
||||
{
|
||||
public class DateTimeOffsetConverterViewModel : BaseViewModel
|
||||
{
|
||||
DateTimeOffset theDate = DateTimeOffset.Now;
|
||||
|
||||
public DateTimeOffset TheDate
|
||||
{
|
||||
get => theDate;
|
||||
set => SetProperty(ref theDate, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using CommunityToolkit.Maui.Sample.Models;
|
||||
using CommunityToolkit.Maui.Sample.Pages.Behaviors;
|
||||
using CommunityToolkit.Maui.Sample.Pages.Converters;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CommunityToolkit.Maui.Sample.ViewModels
|
||||
{
|
||||
public class MainViewModel : BaseGalleryViewModel
|
||||
{
|
||||
protected override IEnumerable<SectionModel> CreateItems() => new[]
|
||||
{
|
||||
new SectionModel(typeof(BehaviorsGalleryPage), "Behaviors", Color.FromArgb("#8E8CD8"),
|
||||
"Behaviors lets you add functionality to user interface controls without having to subclass them. Behaviors are written in code and added to controls in XAML or code"),
|
||||
|
||||
new SectionModel(typeof(ConvertersGalleryPage), "Converters", Color.FromArgb("#EA005E"),
|
||||
"Converters let you convert bindings of a certain type to a different value, based on custom logic"),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Required - Enable Launch Profiles for .NET 6 iOS/Android -->
|
||||
<_KeepLaunchProfiles>true</_KeepLaunchProfiles>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Required - Setup Single Project features -->
|
||||
<ProjectCapability Include="MauiSingleProject" />
|
||||
|
||||
<!-- Optional - Enables a list of TFM's and device categories in the debug menu -->
|
||||
<!-- This allows easily toggling of debug target TFM by selecting the platform -->
|
||||
<!-- If removed, Top level debug targets show as a list of devices for the selected TFM -->
|
||||
<ProjectCapability Include="XamarinStaticLaunchProfiles" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Required - Skip the runtime settings -->
|
||||
<PropertyGroup>
|
||||
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Required - Overwrite tasks that are not needed when multitargeting -->
|
||||
<Target Name="ValidateWinUIPlatform" />
|
||||
<Target Name="BinPlaceBootstrapDll" />
|
||||
|
||||
</Project>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче