Giter Club home page Giter Club logo

simpletoolkit's Introduction

SimpleToolkit

SimpleToolkit is a .NET MAUI library of helpers and simple, easily customizable controls.

The library consists of three NuGet packages:

I have split the content of this library into multiple NuGet packages because there may be people who want to use only the SimpleShell control, for example, and do not want to use other controls.

Caution

Long-term support is not guaranteed. However, this repository is released under the MIT license, so you can always fork the repository and build the packages yourself.

Here are some of my samples that were built using this library:

       

Marvelous .NET MAUI

       

Gadget Store App

       

Navbar Animation #1

       

Hamburger Menu App

Tip

Check out a list of all samples here.

Supported platforms

This library supports all these platforms:

  • Android
  • iOS/Mac Catalyst
  • Windows (WinUI)

SimpleToolkit.Core

SimpleToolkit.Core Documentation

The SimpleToolkit.Core package is a set of simple .NET MAUI controls and helpers.

These are all the controls this package has to offer:

  • Icon - control that allows you to display a tinted image
  • ContentButton - button that can hold whatever content you want
  • Popover - control that allows you to display custom popovers (flyouts) anchored to any control

In order to use the controls listed above, you need to call the UseSimpleToolkit() extension method in your MauiProgram.cs file:

builder.UseSimpleToolkit();

This package also contains some useful helpers. For example, there are helpers that allow you to force application content to be displayed behind the system bars (status and navigation bars) on Android and iOS.

See documentation for more information.

SimpleToolkit.SimpleShell

SimpleToolkit.SimpleShell Documentation

The SimpleToolkit.SimpleShell package provides you with a simplified implementation of .NET MAUI Shell that lets you easily create a custom navigation experience in your .NET MAUI applications. The implementation is simply called SimpleShell.

All SimpleShell is is just a set of containers for your application content with the ability to put the hosting area for pages wherever you want. This gives you the flexibility to add custom tab bars, navigation bars, flyouts, etc. to your Shell application.

Bear in mind that SimpleShell does not come with any navigation controls. SimpleShell just gives you the ability to use custom navigation controls along with the URI-based navigation and automatic navigation stack management.

Important

Before you begin using SimpleShell, I highly recommend familiarizing yourself with the original .NET MAUI Shell - especially with the URI-based navigation, which works exactly the same as in SimpleShell. The SimpleShell class inherits from the Shell class.

In order to use SimpleShell, you need to call the UseSimpleShell() extension method in your MauiProgram.cs file:

builder.UseSimpleShell();

Why not use SimpleShell and use .NET MAUI Shell instead

  • .NET MAUI Shell offers a platform-specific appearance.
  • Platform-specific navigation controls that .NET MAUI Shell provides probably have better performance than controls composed of multiple .NET MAUI views.
  • A SimpleShell-based application may not have as good accessibility in some scenarios due to the lack of platform-specific navigation controls. .NET MAUI Shell should be accessible out of the box since it uses platform-specific controls.
  • Maybe I have implemented something wrong that has a negative impact on the performance, stability, accessibility, or something like that.

See documentation for more information.

SimpleToolkit.SimpleShell.Controls

SimpleToolkit.SimpleShell.Controls Documentation

SimpleToolkit.SimpleShell.Controls is a collection of ready-to-use, navigation-related controls (not only) for SimpleShell.

The package currently supports only two controls:

  • ListPopover - popover containing a list of selectable text items
  • TabBar

All controls can be styled using different design languages. These are currently supported:

  • Material 3
  • Cupertino
  • Fluent (WinUI 3)

Caution

I am still not decided if I want to continue and how to develop the SimpleToolkit.SimpleShell.Controls package. The package API is likely to change in the future. For this reason, this package is still in preview and has poor documentation.

See documentation for more information.

simpletoolkit's People

Contributors

radekvym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpletoolkit's Issues

Multiple Navigation (page1=>page2=>page3)

Hello, I used SimpleShell. Please help me to implement a hierarchy of pages and navigate through them, that is, return to the previous page.
page1=>page2=>page3 (back to page2)
GotoAsync build in back button does not go back to previous page, when working with 3 or more

Converting from SimpleShell to Shell?

HI,

When trying to convert GadgetStoreApp to use Shell instead of SimpleShell I am receiving the error "The property 'ShellContents' was not found in type 'AppShell'" at AppShell.xaml with this line of code:
BindableLayout.ItemsSource="{Binding Source={x:Reference thisShell}, Path=ShellContents}"
Is it possible to user Shell instead of SimpleShell please?
Thanks,
AG

DisplayContentBehindBars

Hello.

I´m trying to use the DisplayContentBehindBars function in my app.
On IOS, the statusbar is being displayed transparent as expected.
On Android it´s being displayed WHITE.

I know your Marvelous sample and in your sample the code works on android as well. I tried to figure out if I was missing something, but didn´t find any significant difference. One thing: I´m not using your shell implementation.

Is there anything special I missed one has to do to get ir running on android?

Thanks for your help!

Swipe to go back gesture not working in iOS

Hello,

While the swipe to go back gesture works fine in Android, in iOS it's not working at all.
I am pushing the page like this from within a tab: Shell.Current.GoToAsync("route");

Is there any workaround?

PS. Congrats on this great plugin, it really brings much needed features to Shell.

Shell search handler ?

Hi does this support shell search? because when I migrate from the built-in Shell the Shell Search disappeared

How to set or change active Tab UI

This library is great. I almost got the UI what I wanted.

Can you give suggestion for How to set the opacity of the active tab 1 and not active tab opacity is 0.6.

I achieve the bottom tab opacity by code. But at the top bar I couldn't get the look what I wanted.

My suggestion is to give an example of active and nonactive UI using Visual State Manager or something else without code behind.

Screenshot_1701681459

[UPDATE] .net 8 support

Dear RadekVyM,

First of all, super thank you for this library and it's super awesome.

Please kindly support .net 8 in near future.
Currently, I'm facing below error at .net 8 project.

image

Best Regards,

Can not use Simple Shell "Unable to cast object of type 'Microsoft.Maui.Controls.Handlers.ShellItemHandler' to type 'SimpleToolkit.SimpleShell.Handlers.SimpleShellItemHandler"

Hi I wanted to try the toolkit but unfortunately I am getting an error whenever I launch my app on Windows:

{"Unable to cast object of type 'Microsoft.Maui.Controls.Handlers.ShellItemHandler' to type 'SimpleToolkit.SimpleShell.Handlers.SimpleShellItemHandler'."}

What I did was to simply follow the Sample and I tried to track down my issue for the last couple hours without success.

I stripped my shell to the most basic possible and it looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<simpleShell:SimpleShell
    x:Class="BoxingTimer.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:BoxingTimer"
    xmlns:simpleShell="clr-namespace:SimpleToolkit.SimpleShell;assembly=SimpleToolkit.SimpleShell"
    x:Name="thisShell">


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

</simpleShell:SimpleShell>

I did include .UseSimpleShell() .UseSimpleToolkit()

Maybe you can help me troubleshooting this, I have tried with a new .NET8 application and it worked fine though

Full stack trace:

at SimpleToolkit.SimpleShell.Handlers.SimpleShellHandler.CreateShellItemHandler()
at SimpleToolkit.SimpleShell.Handlers.SimpleShellHandler.SwitchShellItem(ShellItem newItem, Boolean animate)
at SimpleToolkit.SimpleShell.Handlers.SimpleShellHandler.MapCurrentItem(SimpleShellHandler handler, ISimpleShell shell)
at Microsoft.Maui.PropertyMapper2.<>c__DisplayClass5_0.<Add>b__0(IElementHandler h, IElement v) at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property) at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property) at SimpleToolkit.SimpleShell.Handlers.SimpleShellHandler.MapContent(SimpleShellHandler handler, ISimpleShell shell) at Microsoft.Maui.PropertyMapper2.<>c__DisplayClass5_0.b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler2.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.WindowHandler.MapContent(IWindowHandler handler, IWindow window)
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0.b__0(IElementHandler h, IElement v)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.SetHandler(IWinRTObject nativeElement, IElement element, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.SetWindowHandler(Window platformWindow, IWindow window, IMauiContext context)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(Application platformApplication, IApplication application, OpenWindowRequest args)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(Application platformApplication, IApplication application, LaunchActivatedEventArgs args)
at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args)
at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args)
at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args)

Probably Behaviors not working in Simpleshell

My xaml markup code is (code have the behavior)

<simpleShell:SimpleShell.Content>
	<Grid RowDefinitions="50, *">
		...
		<Grid x:Name="MenuContent"
			  Grid.Row="0"
			  Grid.RowSpan="2"
			  IsVisible="False">
			...
				<Grid.Behaviors>
					<IsVisibleAnimBehavior x:Name="IsVisibleAnimBehavior" ChangeVisibility="True" />
					<PositionAnimBehavior AnimationDuration="300" Easing="{x:Static Easing.BounceOut}" StartPositionX="-400" />
				</Grid.Behaviors>

			</Grid>
		</Grid>
	</Grid>
</simpleShell:SimpleShell.Content>

IsVisibleAnimBehavior behavior is responsible for triggering the animation whenever the visibility changes.

When app runs, I got exception like

System.ArgumentException: 'Unable to find IAnimationManager for 'Microsoft.Maui.Controls.Grid'. (Parameter 'animatable')'

The behavior works fine with normal Content Page.

How to navigate from tap gesture?

i have .xaml like this:

  <Label.GestureRecognizers>
      <TapGestureRecognizer
          x:Name="tapInbox"
          Tapped="tapInbox_Tapped"
          NumberOfTapsRequired="1"/>
  </Label.GestureRecognizers>
    void tapInbox_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
    {
        this.GoToAsync($"///{PageType.InboxPage}", true);
    }

and i register route like this:

Routing.RegisterRoute(nameof(PageType.InboxPage), typeof(InboxPage));

i need help because i don't know how to fix this

ButtonContent does not display icon

Downloaded latest version of SimpleToolkit.Core (3.0.0) from Nuget.

Added the UseSimpleToolkit to builder as suggested in documentation

var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .RegisterAppServices() .UseSimpleToolkit() .RegisterViewModels() .RegisterViews() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); });
Added the namespace to my page:

xmlns:simpleCore="clr-namespace:SimpleToolkit.Core;assembly=SimpleToolkit.Core"

I didn't see any mention in the documentation as to what the namespace should be so making an assumption that this is the correct one since I was able to access the ButtonContent from it.

And this is the xaml code for the ContentButton:

<simpleCore:ContentButton> <HorizontalStackLayout Padding="12,10" Spacing="10"> <simpleCore:Icon Source="email32.png" TintColor="Red" VerticalOptions="Center" HeightRequest="18" WidthRequest="18"/> <Label Text="Sign in with email" TextColor="White" FontAttributes="Bold" VerticalOptions="Center"/> </HorizontalStackLayout> </simpleCore:ContentButton>
It displays the text ok but not the icon. When I changed the simpleCore:icon TintColor property to red that I spotted a little red square but no image.

I'm testing this with an Android project where my icons (.png) are stored under Platforms\Android\Resources\drawable folder. Note that my icon gets displayed when I use:

<Image Source="email32.png" WidthRequest="30" HeightRequest="30" Margin="10"/>

which would indicate that the icon is available to the project.

Any ideas how to resolve this?

Thanks

The app crashes with SimpleShell

Hello,
I've just stumbled upon your SimpleToolkit and I wanted to implement it. It looks awesome, has some stuff that I need and also Material3 TabBar in Controls.

Right now I'm getting unhandled exception:
Java.Lang.IllegalArgumentException: 'No view found for id 0x5 (unknown) for fragment SimpleFragment{acb1dc6} (0b7617ee-9aaa-4da3-88ab-d0e65a35f48c id=0x5)'

I'm trying to follow the guide to have basic implementation for starters and I swapped everything for SimpleShell. So I'm gonna give you a tour over it.
MauiProgram.cs

using MauiApp2.Views;
using MauiApp2.ViewModels;
using Microsoft.Extensions.Logging;
using CommunityToolkit.Maui;
using Material.Components.Maui.Extensions;
using Material.Components.Maui;
using SimpleToolkit.Core;
using SimpleToolkit.SimpleShell;

namespace MauiApp2;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseMauiCommunityToolkit()
            //TODO .UseMaterialComponents()
            .UseSimpleShell()



            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });


#if DEBUG
        builder.Logging.AddDebug();
#endif
        return builder.Build();
    }
}

App.xaml.cs

namespace MauiApp2;

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MainPage = new AppShell();
    }
}

AppShell.xaml. I have login page route and the main one with tab bar.

<?xml version="1.0" encoding="UTF-8" ?>
<simpleShell:SimpleShell
    x:Class="MauiApp2.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:DetailsViews="clr-namespace:MauiApp2.Views.DetailsViews"
    xmlns:Views="clr-namespace:MauiApp2.Views"
    xmlns:local="clr-namespace:MauiApp2"
    xmlns:simpleShell="clr-namespace:SimpleToolkit.SimpleShell;assembly=SimpleToolkit.SimpleShell"
    Shell.FlyoutBehavior="Disabled">





    <ShellItem FlyoutItemIsVisible="False" Route="LandingPage">
        <ShellContent ContentTemplate="{DataTemplate Views:LandingPage}" />
    </ShellItem>

    <TabBar Route="main">
        <Tab Title="Home" Icon="home.png">
            <ShellContent ContentTemplate="{DataTemplate Views:HomePage}" />
        </Tab>
        <Tab Title="Profile" Icon="user.png">
            <ShellContent ContentTemplate="{DataTemplate Views:ProfilePage}" />
        </Tab>
        <Tab Title="Anime" Icon="play_anime.png">
            <ShellContent ContentTemplate="{DataTemplate Views:AnimeListPage}" />
        </Tab>
        <Tab Title="Manga" Icon="read_manga.png">
            <ShellContent ContentTemplate="{DataTemplate Views:MangaListPage}" />
        </Tab>
        <Tab Title="Settings" Icon="settings.png">
            <ShellContent ContentTemplate="{DataTemplate Views:SettingsPage}" />
        </Tab>
    </TabBar>

</simpleShell:SimpleShell>
using MauiApp2.Views;
using MauiApp2.Views.DetailsViews;
using SimpleToolkit.SimpleShell;

namespace MauiApp2;

public partial class AppShell : SimpleToolkit.SimpleShell.SimpleShell
{
    public AppShell()
    {
        Routing.RegisterRoute("MediaDetailsPage", typeof(MediaDetailsPage));
        Routing.RegisterRoute("MediaCharacterListPage", typeof(MediaCharacterListPage));
        Routing.RegisterRoute("MediaStaffListPage", typeof(MediaStaffListPage));
        InitializeComponent();
    }
}

When I'm loading the app on that login page, it checks for token on apperance etc and goes to main route. I'm pointing this out now that I've also tried with just Shell

            if (validation)
            {
                await SimpleToolkit.SimpleShell.SimpleShell.Current.GoToAsync($"//main");
            }

This is the only Shell and navigation stuff that happens and I'm crashing. When I'm swapping everything back to Shell it will load my app. So I've need some help, because maybe I'm missing something. Are all toolkit nugets supposed to be installed on platform specific projects too? Because I didn't get an option to do so. Just the main one. Which might be the problem..

From my main project file:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net8.0-android</TargetFrameworks>

I don't have 34 after android like in nuget requirements. But yeah it's targetting 34. I don't have 34 because the app just wouldn't start with numbera after android, after .net 8 upgrade.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.