### Install Sharpnado Tabs MAUI Source: https://github.com/roubachof/sharpnado.tabs/blob/main/Maui.Tabs/ReadMe.md This code snippet shows how to install and enable Sharpnado Tabs in a MAUI application by adding the 'UseSharpnadoTabs' extension method in the MauiProgram.cs file. It highlights the basic setup required to integrate the library. ```csharp public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() .UseSharpnadoTabs(loggerEnabled: false); } ``` -------------------------------- ### Initialize SharpnadoTabs in MAUI App Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Initializes the Sharpnado.Tabs library within a .NET MAUI application by calling the `UseSharpnadoTabs` extension method in `MauiProgram.cs`. This setup is required before using the tab controls. ```csharp public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() .UseSharpnadoTabs(loggerEnable: false); return builder.Build(); } ``` -------------------------------- ### MAUI Setup: Initialize Sharpnado.Tabs Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This code snippet demonstrates how to initialize the Sharpnado.Tabs library within your .NET MAUI application's MauiProgram.cs file. It involves adding the '.UseSharpnadoTabs()' extension method to the MauiAppBuilder. ```csharp public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() .UseSharpnadoTabs(loggerEnable: false); return builder.Build(); } } ``` -------------------------------- ### BottomTabItem Styling Example Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md Applies a style to BottomTabItems, customizing selected tab color, unselected label and icon colors, font family, label size, icon size, and text visibility. ```xml ``` -------------------------------- ### LazyView Code-Behind Example (C#) Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Demonstrates the code-behind implementation of a view that can be used with LazyView. The constructor of this view is only called when the LazyView becomes active, indicating deferred initialization. This snippet is written in C#. ```csharp // LazyView implementation in code-behind public class HomeView : ContentView { public HomeView() { // This constructor is only called when the tab is selected Content = new VerticalStackLayout { Children = { new Label { Text = "Home Content Loaded!" } } }; } } ``` -------------------------------- ### Implement ViewModel Command for TabButton Action Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Provides a C# ViewModel implementation for handling the TapCommand associated with a TabButton. This example shows how to define an ICommand and execute an asynchronous action, such as displaying an alert or navigating. ```csharp // ViewModel with TabButton command public class MainViewModel { public ICommand TakePictureCommand { get; } public MainViewModel() { TakePictureCommand = new Command(async () => { await Shell.Current.DisplayAlert("Action", "Camera button tapped!", "OK"); // Or navigate to camera page, etc. }); } } ``` -------------------------------- ### Basic TabHostView and ViewSwitcher Usage in XAML Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md Demonstrates the fundamental setup for Sharpnado.Tabs using XAML. It shows how to bind the `SelectedIndex` property between `TabHostView` and `ViewSwitcher` to synchronize tab selection with content display. This is essential for creating basic tabbed interfaces. ```xml ``` -------------------------------- ### XML Basic TabButton Configuration Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md A simple configuration of a TabButton in XAML, showcasing basic styling properties such as Padding, ButtonBackgroundColor, ButtonPadding, CornerRadius, and IconImageSource. This example illustrates how to create a standard, non-circular tab button with custom visual attributes. ```xml ``` -------------------------------- ### Accessing Deployed Raw Assets with C# Source: https://github.com/roubachof/sharpnado.tabs/blob/main/MauiSample/Resources/Raw/AboutAssets.txt This C# code snippet shows how to load and read the contents of a raw asset file that has been deployed with your .NET MAUI application. It uses the Essentials FileSystem.OpenAppPackageFileAsync method to get a stream to the asset and then reads its content using a StreamReader. ```csharp async Task LoadMauiAsset() { using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); using var reader = new StreamReader(stream); var contents = reader.ReadToEnd(); } ``` -------------------------------- ### TabHostView Vertical Tab Configuration Example Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md Configures a TabHostView for vertical tabs by setting its orientation to Horizontal and adjusting width and height requests. This is useful for landscape or tablet layouts. ```xml ``` -------------------------------- ### Basic Tab Navigation with TabHostView and ViewSwitcher in XAML Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt This XAML code defines a basic tab navigation structure for a .NET MAUI page using Sharpnado.Tabs. It includes a `TabHostView` for the tab bar and a `ViewSwitcher` for content display, both synchronized via a `SelectedIndex` binding. The example showcases custom tab items with styling. ```xaml ``` -------------------------------- ### MAUI TabHostView with BottomTabItems and UnderlinedTabItem Source: https://github.com/roubachof/sharpnado.tabs/blob/main/Maui.Tabs/ReadMe.md This XAML snippet demonstrates the creation of a TabHostView in MAUI, configuring it for horizontal orientation, fixed tab type, and segmented appearance. It includes examples of BottomTabItem with badges and UnderlinedTabItem, showcasing customization options like styling, labels, and colors. ```xml ``` -------------------------------- ### XML TabHostView with Custom TabButton Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md An example of integrating a custom TabButton within a TabHostView. This snippet demonstrates how to use properties like ButtonCircleSize, ButtonPadding, and visual adjustments (Scale, TranslationY) to create a prominent, circular tab button that extends beyond the standard tab bar. ```xml ``` -------------------------------- ### Implement iOS Segmented Control with TabHostView Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XML snippet demonstrates how to configure a TabHostView to mimic the iOS segmented control style. It utilizes properties like IsSegmented, SegmentedHasSeparator, and SegmentedOutlineColor to achieve the desired appearance. This setup is suitable for defining navigation or selection within a UI. ```xml ``` -------------------------------- ### Build Using Solution Files Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds projects using solution files for both the sample application and the main library. This is a high-level build command for the entire solution. ```bash # Using solution files dotnet build MauiSample/MauiSample.sln dotnet build Maui.Tabs/Maui.Tabs.sln ``` -------------------------------- ### Build Main Sample App (Debug) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds the primary sample application for Sharpnado.Tabs in Debug mode, facilitating development and testing of the library's features within a sample context. ```bash # Build the main sample app dotnet build MauiSample/MauiSample.csproj -c Debug ``` -------------------------------- ### Initialize Sharpnado.Tabs in MAUI Application Startup Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt This C# code snippet demonstrates how to initialize the Sharpnado.Tabs library within your .NET MAUI application's startup class. It involves configuring the MauiApp builder and calling the `UseSharpnadoTabs` extension method. This is a prerequisite for using any of the library's components. ```csharp public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() .UseSharpnadoTabs(loggerEnable: false, debugLogEnable: false); return builder.Build(); } } ``` -------------------------------- ### Restore Dependencies for Sample App Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Restores all necessary NuGet dependencies for the sample application. This command ensures that all required libraries are available before building. ```bash # Restore dependencies for sample dotnet restore MauiSample/MauiSample.sln ``` -------------------------------- ### Build Main Library (Release) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds the main Sharpnado.Tabs library in Release configuration for optimized performance and deployment. This command is essential for creating the production-ready library. ```bash # Build the main library dotnet build Maui.Tabs/Maui.Tabs.csproj -c Release ``` -------------------------------- ### Build Shell Sample App (Debug) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds the Shell sample application for Sharpnado.Tabs in Debug mode. This targets a specific sample structure for testing. ```bash # Build Shell sample dotnet build MauiShellSample/MauiShellSample.csproj -c Debug ``` -------------------------------- ### Delayed Content Loading (XAML) Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Optimizes startup time by delaying the construction of UI elements using DelayedView. Views specified within DelayedView are only built after a specified delay, reducing initial rendering load. Supports accent color, animation, and activity indicators. Requires Sharpnado.Tabs. ```xaml ``` -------------------------------- ### Build Sample App for Specific Platforms (Debug) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds the sample application for specific target platforms (Android, iOS, MacCatalyst) in Debug mode. This allows testing cross-platform compatibility during development. ```bash # Build for specific platforms dotnet build MauiSample/MauiSample.csproj -f net9.0-android -c Debug dotnet build MauiSample/MauiSample.csproj -f net9.0-ios -c Debug dotnet build MauiSample/MauiSample.csproj -f net9.0-maccatalyst -c Debug ``` -------------------------------- ### Create NuGet Package (Release) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Creates a NuGet package for the Sharpnado.Tabs library when built in Release mode. This is typically automated by the 'PackOnBuild=true' setting for Release builds. ```bash # Create NuGet package (automatically done with Release builds due to PackOnBuild=true) dotnet pack Maui.Tabs/Maui.Tabs.csproj -c Release ``` -------------------------------- ### Build Main Library (Debug) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/BUILD.md Builds the main Sharpnado.Tabs library in Debug configuration, enabling easier troubleshooting and development. This is useful during the development lifecycle. ```bash # Build library in debug mode dotnet build Maui.Tabs/Maui.Tabs.csproj -c Debug ``` -------------------------------- ### MauiAsset Build Action in .csproj Source: https://github.com/roubachof/sharpnado.tabs/blob/main/MauiSample/Resources/Raw/AboutAssets.txt This XML snippet demonstrates how to configure the MauiAsset Build Action in your .csproj file to include all files within the Resources\Raw directory and its subdirectories in your application package. The LogicalName attribute ensures the file is deployed with its original relative path. ```xml ``` -------------------------------- ### Lazy Content Loading (XAML) Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Implements lazy loading of content using the LazyView component. Content is only loaded when its corresponding tab is selected, improving initial load performance. Supports optional activity indicators and custom loading views. Requires Sharpnado.Tabs. ```xaml ``` -------------------------------- ### XML: Apply Standard Touch Effect to TabHostView Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XML snippet demonstrates applying a Standard touch effect to a TabHostView in .NET MAUI with Sharpnado.Tabs. The TouchColor is set to a static resource, and TouchEffectType is set to Standard. ```xml ``` -------------------------------- ### Integrating Custom SPAM Tabs into TabHostView Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XML shows how to use the custom SpamTab within the TabHostView. Multiple SpamTab instances are declared, each with a different 'SpamImage' source, demonstrating how to populate the tab view with various custom tab items. The SelectedIndex is bound to a ViewModel for interactive control. ```xml ``` -------------------------------- ### XAML Material Design Tabs with Sharpnado.Tabs Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt This XAML code defines a Material Design tab host using sharpnado.tabs. It supports scrollable tabs, custom touch effects, and various icon/text combinations. The TabHostView is bound to a SelectedIndex property for navigation, and it includes configurations for icon position, size, color, and underline style. A ViewSwitcher manages the content displayed for each tab. ```xaml ``` -------------------------------- ### Custom TabItem XML Structure for SPAM Tabs Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XML snippet defines a custom TabItem named SpamTab, which is designed to display a 'SPAM' theme. It includes two Image elements, 'Spam' and 'Foot', positioned within a Grid. The 'SpamImage' property is bound to a ViewModel, allowing for dynamic image sources. This structure is part of creating highly customizable tab views. ```xml ``` -------------------------------- ### MaterialUnderlinedTabItem Configuration in XAML Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XAML snippet demonstrates how to configure MaterialUnderlinedTabItem within a TabHostView. It showcases various properties such as IconImageSource, IconOptions, IconSize, IconTextSpacing, Label, and UnderlineHeight. This allows for customization of individual tab items according to Material Design guidelines. ```xml ``` -------------------------------- ### Configure MAUI TabHostView Touch Feedback Effects in XAML Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Illustrates various touch effect configurations for the TabHostView using XAML. This includes Material Design circular ripple, iOS-style standard touch effect, and a fallback 'poorman's ripple'. Each effect can be customized with TouchColor and TouchEffectType. ```xaml ``` -------------------------------- ### Add Badges to UnderlinedTabItem in Sharpnado Tabs Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This snippet demonstrates how to incorporate badges into UnderlinedTabItems using Sharpnado Tabs. It showcases various customization options for the BadgeView, including styling, padding, font, and text. ```xml ``` -------------------------------- ### Styling UnderlinedTabItem (XAML Resources) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XAML code defines a style for the UnderlinedTabItem within the ContentPage's resources. It allows customization of selected tab color, font family, label size, and unselected label color, providing a way to visually distinguish tabs. ```xml ``` -------------------------------- ### MAUI ViewSwitcher with DelayedView and LazyView Source: https://github.com/roubachof/sharpnado.tabs/blob/main/Maui.Tabs/ReadMe.md This XAML snippet illustrates how to use a ViewSwitcher in MAUI to manage content displayed based on the selected tab. It utilizes DelayedView and LazyView to load different content types (TabM, TabA, TabU, TabI) with options for animation, accent color, and activity indicators. ```xml ``` -------------------------------- ### XAML Bottom Navigation Bar with Icons and Badges Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt This XAML code defines a bottom navigation bar using `TabHostView` and `BottomTabItem`. It supports customizable icons, labels, colors, and the addition of badges with text or indicators. The `ViewSwitcher` manages the content displayed based on the selected tab. ```xaml ``` -------------------------------- ### ViewModel for Tab Navigation and Data Loading (C#) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This C# code defines a ViewModel that manages the data loading and state for the tabbed interface. It utilizes TaskLoaderNotifier for asynchronous loading and exposes properties for the different view models (Quote, Filmo, Meme) and the selected tab index. The LoadSillyDude method handles fetching data and updating the view models. ```csharp public TaskLoaderNotifier SillyDudeLoader { get; } public QuoteVmo Quote { get; private set; } public FilmoVmo Filmo { get; private set; } public MemeVmo Meme { get; private set; } public int SelectedViewModelIndex { get => _selectedViewModelIndex; set => SetAndRaise(ref _selectedViewModelIndex, value); } public override void Load(object parameter) { SillyDudeLoader.Load(() => LoadSillyDude((int)parameter)); } private async Task LoadSillyDude(int id) { var dude = await _dudeService.GetSilly(id); Quote = new QuoteVmo( dude.SourceUrl, dude.Description, new TapCommand(url => Device.OpenUri(new Uri((string)url)))); Filmo = new FilmoVmo(dude.FilmoMarkdown); Meme = new MemeVmo(dude.MemeUrl); RaisePropertyChanged(nameof(Quote)); RaisePropertyChanged(nameof(Filmo)); RaisePropertyChanged(nameof(Meme)); return new SillyDudeVmo(dude, null); } ``` -------------------------------- ### XML: Apply PoorsManRipple Touch Effect to TabHostView Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XML snippet illustrates how to apply a PoorsManRipple touch effect to a TabHostView in .NET MAUI using Sharpnado.Tabs. The TouchColor is set to 'BlueViolet', and TouchEffectType is set to PoorsManRipple. ```xml ``` -------------------------------- ### UnderlinedTabItem Usage with TabHostView and ViewSwitcher (XAML) Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This XAML snippet demonstrates how to integrate the TabHostView and ViewSwitcher components to create a tabbed interface. The TabHostView displays the tabs, and the ViewSwitcher shows the content associated with each tab. Both components are linked via their SelectedIndex property, which is often bound to a ViewModel property. ```xml ``` -------------------------------- ### Xamarin.Forms Animation for Custom Tab Elements Source: https://github.com/roubachof/sharpnado.tabs/blob/main/README.md This C# code snippet demonstrates how to apply animations to elements within a custom tab item, specifically the 'Foot' and 'Spam' images. It uses Xamarin.Forms animation APIs like FadeTo, TranslateTo, and HeightRequestTo, combined with Task.WhenAll for synchronized animations. The animation logic is encapsulated within a NotifyTask.Create call for asynchronous execution. ```csharp private void Animate(bool isSelected) { double targetFootOpacity = isSelected ? 1 : 0; double targetFootTranslationY = isSelected ? 0 : -_height; double targetHeightSpam = isSelected ? 0 : _height; NotifyTask.Create( async () => { Task fadeFootTask = Foot.FadeTo(targetFootOpacity, 500); Task translateFootTask = Foot.TranslateTo(0, targetFootTranslationY, 250, Easing.CubicOut); Task heightSpamTask = Spam.HeightRequestTo(targetHeightSpam, 250, Easing.CubicOut); await Task.WhenAll(fadeFootTask, translateFootTask, heightSpamTask); Spam.HeightRequest = targetHeightSpam; Foot.TranslationY = targetFootTranslationY; Foot.Opacity = targetFootOpacity; }); } ``` -------------------------------- ### Add Action Buttons to Tab Bar in XAML Source: https://context7.com/roubachof/sharpnado.tabs/llms.txt Demonstrates how to integrate a custom TabButton with an elevated appearance and tap command into a TabHostView. This allows for distinct action buttons alongside standard tabs. Ensure the ViewModel has a corresponding command defined. ```xaml ```