DevWinUI

repository·main·Indexed 43 days ago

https://github.com/ghost1372/devwinui

A suite of libraries and tools for WinUI 3 application development featuring high-performance components, custom styles, and Native AOT compatibility. It includes DevWinUI.Base for core utilities, DevWinUI.Shader for GPU-accelerated HLSL compute shader backgrounds via Win2D and ComputeSharp, DevWinUI.ContextMenu for modern Windows 10/11 context menus, and DevWinUI.SourceGenerator for automated mapping and property generation.

Tokens
6.1K
Snippets
17
Records
28
Agent score
54%

What's inside DevWinUI

  1. Overview of DevWinUI

    main

    DevWinUI is a comprehensive collection of libraries, components, styles, shaders, and tools designed to accelerate the development of WinUI 3 applications. It is built around Microsoft's modern native UI framework and follows Fluent Design principles.

    Key features include:

    • Native AOT Compatible: 99% full support for Native AOT compilation.
    • Accelerated Development: Provides pre-built templates, scaffolding tools, and helper classes for navigation, theming, and app lifecycle management.
    • Optimized Performance: Purpose-built components for high performance and responsiveness.
    • WinUI 3 Focused: Designed for modern desktop experiences on Windows 10 and Windows 11.
  2. Explore DevWinUI components and shaders

    main

    DevWinUI provides a wide array of UI components, shaders, and visual effects for WinUI applications. This section of the documentation serves as a visual gallery of available features, including:

    Shaders and Visual Effects

    • Background Shaders: WavyBackgroundShader, WallpaperShader, TriangleGradientBackgroundShader, ResidualBackgroundRadiationShader, PS3XMBBackgroundShader, GradientFlowShader, ColourfulBubblesShader, AbstractMovementBackgroundShader, CosmicShader, StarNestShader, StarNoiseShader, SparkShader, FireShader, MatrixShader, CoverShader, FluidShader, SeventiesMeltShader, IceAndFireShader, RaindropShader, SnowShader, FogShader.
    • Specialized Renderers: EdgeFeatheringRenderer, PureColorRenderer, EdgeLighting, ColorShadow, Halo, FrostedGlass.

    UI Components and Controls

    • Navigation & Layout: SidebarView, Toolbar, BreadcrumbBar, SnapLayoutManager, CarouselView (and CarouselView2), CoverFlow, ContentSlider, StoreCarousel.
    • Data & Information Display: LiveGraph, SpectrumAnalyzer, WaveformTimeline, LoopPanel, InfoCard, ProfileControl, BannerView, FluidBanner, AnimatedTextBlock.
    • Interactive Controls: ClockPicker, PasswordGenerator, EyeDropper, NTPClient, Barcode, QRCode, RichButton, Spoiler, OrbitLoadingIndicator, Countdown.
    • Visual Helpers: TextBlockHelper, ParallaxTilt, ThemedIcon, CircleIcon, ImageFrame, BlendedImage.
  3. Explore DevWinUI UI Components and Effects

    main

    DevWinUI provides a wide array of specialized UI components, visual effects, and control styles for WinUI applications. This segment of the documentation showcases various visual capabilities available in the library, including:

    Layout & Navigation

    • TabViewItem Rounded Style: Rounded tab item designs.
    • NavigationView MS Store Style: Navigation views styled like the Microsoft Store.
    • Accordion: Collapsible content sections.
    • StepBar: Progress or step-based navigation.
    • HeaderCarousel: A carousel for header content.

    Visual Effects & Animations

    • Blur Effects: Managed via BlurEffectManager and BlurEffectControl.
    • Shimmer: ShimmerTextBlock and general shimmer effects for loading states.
    • Particles & Backgrounds: WanderingParticles, SnowFlakeEffect, and AnimatedGradient.
    • Depth & Perspective: DepthLayerView, PerspectiveZoom, and CompositionShadow.
    • Image Effects: ImageEffectBrush and BlurEffectBrush.

    Specialized Controls

    • Data Display: Timeline, SpeedGraph, StorageBar, StorageRing, and DigitalSegment (including 14/16 segment character displays).
    • Selection & Input: SegmentedSlider, LoopingSelector, DropdownColorPicker, and ColorSlideControl.
    • Cards & Tiles: GoToCard, FlipCards, FlipBlock, HeaderTile, and Card.
    • System Integration: SystemTrayIcon, ModernSystemMenu, and DragMoveAndResize functionality.

    Interaction & Feedback

    • Feedback: ConfettiCannon for success states and MessageBox / WindowedContentDialog for alerts.
    • Shortcuts: Shortcut, ShortcutPreview, and ShortcutWithTextLabel components.
    • Commands: DelegateCommand for handling interactions.
  4. Explore DevWinUI UI Components and Effects

    main

    DevWinUI provides a wide array of specialized UI components, layout controls, and visual effects for WinUI applications. These can be categorized into several functional groups:

    Layout & Navigation

    • LayoutTransformer: Dynamic layout transformations.
    • FlexPanel: Flexible panel layout.
    • HoneycombPanel: Hexagonal/honeycomb grid layout.
    • CirclePanel: Circular arrangement of elements.
    • BreadcrumbNavigator: Navigation path tracking.
    • PagerControl: Pagination controls.
    • AutoScrollView: Automatic scrolling behavior.
    • GoToTop: Quick navigation to the top of a view.

    Specialized Controls

    • CompareSlider: A slider for comparing two states or images.
    • DateTimePicker / CalendarWithClock: Advanced date and time selection.
    • PinBox: A control for pinning elements.
    • SelectorBarSegmented: Segmented selection controls.
    • ProgressButton / ProgressRing / WaveProgressBar / IndeterminateProgressBar: Various loading and progress indicators.
    • SwitchPresenter: Toggle/switch UI components.
    • PinBox: A control for pinning elements.
    • Settings / Options Page Control: Pre-built structures for configuration pages.

    Visual Effects & Win2d Integration

    Many effects leverage Win2d for high-performance graphics:

    • Gooey Effects: GooeyButton, GooeyEffect, and GooeyFooterEffect for organic, fluid UI transitions.
    • Particles & Waves: Particle, WaveCircle, and WaveProgressBar.
    • Text Effects: OutlineTextControl, TextBlockStrokeView, TextGlitchEffect, and TextMorphEffect.
    • Backgrounds & Masks: TiledImageBrush, Watermark, BlurAnimationHelper, OpacityMaskView, Transparent Backdrop, and Acrylic Backdrop (including AcrylicBaseBackdrop and AcrylicThinBackdrop).
    • Shimmer: ColorfulShimmingEffect.

    Helpers & Extensions

    • FontIcon Extension: Access over 1400 Fluent Icons by name or code.
    • TextBox Extensions: Enhanced text input with masking and specialized behaviors.
    • AutoSuggestBox Helper: Improved auto-suggestion functionality.
    • RichTextFormatter Helper: Formatting for rich text content.
    • ThemeService: Managing backdrop tint colors and themes.
    • Enum Value Extension: Visual representation of enum values.
  5. DevWinUI coding standards and namespaces

    main

    To maintain compatibility and project structure, follow these rules:

    Namespace Convention

    All code in the DevWinUI project should use the root namespace. Avoid creating sub-namespaces like DevWinUI.Controls.

    • C#: namespace DevWinUI;
    • XAML: xmlns:local="using:DevWinUI"

    Native AOT Compatibility

    • Partial Classes: All control and helper classes must be marked as partial.
    • No Reflection: Avoid reflection-based logic or indirect type access, as these break Native AOT compatibility.

    Build Configurations

    • Debug: Targets only .NET 10 for faster iteration.
    • Release: Targets .NET 8, .NET 9, and .NET 10, and generates NuGet packages in the Output/ directory.
  6. Requirements for using DevWinUI.ContextMenu

    main

    DevWinUI.ContextMenu is designed for Windows 10 and 11. To use it, your application must meet the following criteria:

    • Target Framework: .NET 8.0 or higher.
    • Packaging: The application must support Package Identity. This means you can use it in WPF or WinForms applications, provided they are deployed using MSIX Packaging.
  7. Choose the correct DevWinUI package for v10.0.0+

    main

    In version v10.0.0 and above, the library is split into two options depending on your requirements:

    • DevWinUI (Recommended): The full package containing both custom controls, styles, XAML resources, and core utilities (services, helpers, extensions, managers). Use this for most standard implementations.
    • DevWinUI.Base: Contains only the core utilities. Use this if you only need the underlying logic and do not require the UI controls or XAML themes.
  8. Install DevWinUI.Shader

    main

    You can install DevWinUI.Shader using either the NuGet Package Manager Console or the .NET CLI.

    Prerequisites:

    • This library requires TargetFrameworks 22621+.
    • It uses Microsoft.Graphics.Win2D and ComputeSharp.D2D1.WinUI internally.
    Install-Package DevWinUI.Shader

    OR

    dotnet add package DevWinUI.Shader
  9. Install and Configure DevWinUI

    main

    Install the DevWinUI package for custom controls, styles, and XAML resources. This package automatically includes DevWinUI.Base.

    Note: This library uses Microsoft.Graphics.Win2D internally.

    After installation, you must add the following resource dictionary to your App.xaml to enable the styles and resources:

    # Install via NuGet
    dotnet add package DevWinUI
    
    # Add to App.xaml
    <ResourceDictionary Source="ms-appx:///DevWinUI/Themes/Generic.xaml" />"
  10. Configure AdditionalFiles for Source Generation

    main

    To trigger specific generators within DevWinUI.SourceGenerator, you must include the relevant files in your .csproj file using the <AdditionalFiles> item group. The specific files required depend on which mapping or property you want to generate:

    • BreadcrumbPageMappings: Include all Page files using <AdditionalFiles Include="@(Page)" />.
    • NavigationPageMappings: Include your navigation JSON file (e.g., Assets\NavViewMenu\AppData.json).
    • StringsPropertyGenerator: Include your resource files (e.g., Strings\en-US\Resources.resw).

    Note: For JSON and .resw files, it is recommended to use the Link attribute and set Visible="false" to ensure they are processed correctly by the generator without cluttering the project tree.

    <ItemGroup>
      <!-- For NavigationPageMappings -->
      <AdditionalFiles Include="Assets\NavViewMenu\AppData.json" Link="%(RecursiveDir)%(Filename)%(Extension)" Visible="false"/>
      
      <!-- For BreadcrumbPageMappings -->
      <AdditionalFiles Include="@(Page)" />
      
      <!-- For StringsPropertyGenerator -->
      <AdditionalFiles Include="Strings\en-US\Resources.resw" Link="%(RecursiveDir)%(Filename)%(Extension)" Visible="false"/>
    </ItemGroup>
  11. Migrate from DevWinUI to DevWinUI.Base (v10.0.0+)

    main

    Starting with version v10.0.0, the core library has been renamed to support meta packages. This is a breaking change.

    Package Mapping

    • v9.9.4 and below: Use DevWinUI for core utilities (services, helpers, extensions, managers).
    • v10.0.0 and above: Use DevWinUI.Base for core utilities.

    Upgrade Steps

    To upgrade from v9.9.4 to v10.0.0 or higher, simply replace the DevWinUI package reference with DevWinUI.Base in your project file.