Preview 3: Complete control implementation with XAML data binding
Major milestone adding full control functionality: Controls Enhanced: - Entry/Editor: Full keyboard input, cursor navigation, selection, clipboard - CollectionView: Data binding, selection highlighting, scrolling - CheckBox/Switch/Slider: Interactive state management - Picker/DatePicker/TimePicker: Dropdown selection with popup overlays - ProgressBar/ActivityIndicator: Animated progress display - Button: Press/release visual states - Border/Frame: Rounded corners, stroke styling - Label: Text wrapping, alignment, decorations - Grid/StackLayout: Margin and padding support Features Added: - DisplayAlert dialogs with button actions - NavigationPage with toolbar and back navigation - Shell with flyout menu navigation - XAML value converters for data binding - Margin support in all layout containers - Popup overlay system for pickers New Samples: - TodoApp: Full CRUD task manager with NavigationPage - ShellDemo: Comprehensive control showcase Removed: - ControlGallery (replaced by ShellDemo) - LinuxDemo (replaced by TodoApp) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Maui.ApplicationModel;
|
||||
@@ -8,9 +9,11 @@ using Microsoft.Maui.ApplicationModel.Communication;
|
||||
using Microsoft.Maui.ApplicationModel.DataTransfer;
|
||||
using Microsoft.Maui.Hosting;
|
||||
using Microsoft.Maui.Platform.Linux.Services;
|
||||
using Microsoft.Maui.Platform.Linux.Converters;
|
||||
using Microsoft.Maui.Storage;
|
||||
using Microsoft.Maui.Platform.Linux.Handlers;
|
||||
using Microsoft.Maui.Controls;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Hosting;
|
||||
|
||||
@@ -47,51 +50,69 @@ public static class LinuxMauiAppBuilderExtensions
|
||||
builder.Services.TryAddSingleton<IBrowser, BrowserService>();
|
||||
builder.Services.TryAddSingleton<IEmail, EmailService>();
|
||||
|
||||
// Register type converters for XAML support
|
||||
RegisterTypeConverters();
|
||||
|
||||
// Register Linux-specific handlers
|
||||
builder.ConfigureMauiHandlers(handlers =>
|
||||
{
|
||||
// Phase 1 - MVP controls
|
||||
handlers.AddHandler<IButton, ButtonHandler>();
|
||||
handlers.AddHandler<ILabel, LabelHandler>();
|
||||
handlers.AddHandler<IEntry, EntryHandler>();
|
||||
handlers.AddHandler<ICheckBox, CheckBoxHandler>();
|
||||
handlers.AddHandler<ILayout, LayoutHandler>();
|
||||
handlers.AddHandler<IStackLayout, StackLayoutHandler>();
|
||||
handlers.AddHandler<IGridLayout, GridHandler>();
|
||||
// Application handler
|
||||
handlers.AddHandler<IApplication, ApplicationHandler>();
|
||||
|
||||
// Phase 2 - Input controls
|
||||
handlers.AddHandler<ISlider, SliderHandler>();
|
||||
handlers.AddHandler<ISwitch, SwitchHandler>();
|
||||
handlers.AddHandler<IProgress, ProgressBarHandler>();
|
||||
handlers.AddHandler<IActivityIndicator, ActivityIndicatorHandler>();
|
||||
handlers.AddHandler<ISearchBar, SearchBarHandler>();
|
||||
// Core controls
|
||||
handlers.AddHandler<BoxView, BoxViewHandler>();
|
||||
handlers.AddHandler<Button, TextButtonHandler>();
|
||||
handlers.AddHandler<Label, LabelHandler>();
|
||||
handlers.AddHandler<Entry, EntryHandler>();
|
||||
handlers.AddHandler<Editor, EditorHandler>();
|
||||
handlers.AddHandler<CheckBox, CheckBoxHandler>();
|
||||
handlers.AddHandler<Switch, SwitchHandler>();
|
||||
handlers.AddHandler<Slider, SliderHandler>();
|
||||
handlers.AddHandler<Stepper, StepperHandler>();
|
||||
handlers.AddHandler<RadioButton, RadioButtonHandler>();
|
||||
|
||||
// Phase 2 - Image & Graphics
|
||||
handlers.AddHandler<IImage, ImageHandler>();
|
||||
handlers.AddHandler<IImageButton, ImageButtonHandler>();
|
||||
handlers.AddHandler<IGraphicsView, GraphicsViewHandler>();
|
||||
// Layout controls
|
||||
handlers.AddHandler<Grid, GridHandler>();
|
||||
handlers.AddHandler<StackLayout, StackLayoutHandler>();
|
||||
handlers.AddHandler<VerticalStackLayout, StackLayoutHandler>();
|
||||
handlers.AddHandler<HorizontalStackLayout, StackLayoutHandler>();
|
||||
handlers.AddHandler<AbsoluteLayout, LayoutHandler>();
|
||||
handlers.AddHandler<FlexLayout, LayoutHandler>();
|
||||
handlers.AddHandler<ScrollView, ScrollViewHandler>();
|
||||
handlers.AddHandler<Frame, FrameHandler>();
|
||||
handlers.AddHandler<Border, BorderHandler>();
|
||||
handlers.AddHandler<ContentView, BorderHandler>();
|
||||
|
||||
// Phase 3 - Collection Views
|
||||
// Picker controls
|
||||
handlers.AddHandler<Picker, PickerHandler>();
|
||||
handlers.AddHandler<DatePicker, DatePickerHandler>();
|
||||
handlers.AddHandler<TimePicker, TimePickerHandler>();
|
||||
handlers.AddHandler<SearchBar, SearchBarHandler>();
|
||||
|
||||
// Progress & Activity
|
||||
handlers.AddHandler<ProgressBar, ProgressBarHandler>();
|
||||
handlers.AddHandler<ActivityIndicator, ActivityIndicatorHandler>();
|
||||
|
||||
// Image & Graphics
|
||||
handlers.AddHandler<Image, ImageHandler>();
|
||||
handlers.AddHandler<ImageButton, ImageButtonHandler>();
|
||||
handlers.AddHandler<GraphicsView, GraphicsViewHandler>();
|
||||
|
||||
// Collection Views
|
||||
handlers.AddHandler<CollectionView, CollectionViewHandler>();
|
||||
handlers.AddHandler<ListView, CollectionViewHandler>();
|
||||
|
||||
// Phase 4 - Pages & Navigation
|
||||
// Pages & Navigation
|
||||
handlers.AddHandler<Page, PageHandler>();
|
||||
handlers.AddHandler<ContentPage, ContentPageHandler>();
|
||||
handlers.AddHandler<NavigationPage, NavigationPageHandler>();
|
||||
handlers.AddHandler<Shell, ShellHandler>();
|
||||
handlers.AddHandler<FlyoutPage, FlyoutPageHandler>();
|
||||
handlers.AddHandler<TabbedPage, TabbedPageHandler>();
|
||||
|
||||
// Phase 5 - Advanced Controls
|
||||
handlers.AddHandler<IPicker, PickerHandler>();
|
||||
handlers.AddHandler<IDatePicker, DatePickerHandler>();
|
||||
handlers.AddHandler<ITimePicker, TimePickerHandler>();
|
||||
handlers.AddHandler<IEditor, EditorHandler>();
|
||||
|
||||
// Phase 7 - Additional Controls
|
||||
handlers.AddHandler<IStepper, StepperHandler>();
|
||||
handlers.AddHandler<IRadioButton, RadioButtonHandler>();
|
||||
handlers.AddHandler<IBorderView, BorderHandler>();
|
||||
|
||||
// Window handler
|
||||
handlers.AddHandler<IWindow, WindowHandler>();
|
||||
// Application & Window
|
||||
handlers.AddHandler<Application, ApplicationHandler>();
|
||||
handlers.AddHandler<Microsoft.Maui.Controls.Window, WindowHandler>();
|
||||
});
|
||||
|
||||
// Store options for later use
|
||||
@@ -99,6 +120,18 @@ public static class LinuxMauiAppBuilderExtensions
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers custom type converters for Linux platform.
|
||||
/// </summary>
|
||||
private static void RegisterTypeConverters()
|
||||
{
|
||||
// Register SkiaSharp type converters for XAML styling support
|
||||
TypeDescriptor.AddAttributes(typeof(SKColor), new TypeConverterAttribute(typeof(SKColorTypeConverter)));
|
||||
TypeDescriptor.AddAttributes(typeof(SKRect), new TypeConverterAttribute(typeof(SKRectTypeConverter)));
|
||||
TypeDescriptor.AddAttributes(typeof(SKSize), new TypeConverterAttribute(typeof(SKSizeTypeConverter)));
|
||||
TypeDescriptor.AddAttributes(typeof(SKPoint), new TypeConverterAttribute(typeof(SKPointTypeConverter)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user