Skip to content

DrMojorisin/ClaudeWPF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

WPFBase - Modern WPF MVVM Framework

Build Status License: MIT .NET GitHub release (latest by date) GitHub issues GitHub stars Documentation

A production-ready WPF MVVM framework built with modern .NET practices and comprehensive architecture patterns.

πŸš€ Features

Core Architecture

  • Modern MVVM with CommunityToolkit.Mvvm source generators
  • Dependency Injection using Microsoft.Extensions.DependencyInjection
  • Async/Await patterns throughout
  • Repository Pattern with Unit of Work for data access

UI & UX

  • AvalonDock - Visual Studio-style docking windows
  • Theme Management - Light/Dark themes with runtime switching
  • Value Converters - Comprehensive library of XAML converters
  • Validation - Both DataAnnotations and FluentValidation support
  • Custom Controls - Reusable WPF controls

Services

  • Navigation Service - Type-safe navigation with parameters
  • Dialog Service - Unified dialog management (messages, files, custom)
  • Message Bus - Decoupled pub/sub communication
  • Configuration Service - JSON-based configuration
  • User Settings - Persistent user preferences
  • Keyboard Shortcuts - Customizable keyboard shortcuts
  • Logging - Structured logging with Serilog
  • Theme Service - Runtime theme switching

πŸ“ Project Structure

WPFBase/
β”œβ”€β”€ Commands/           # Custom ICommand implementations
β”œβ”€β”€ Controls/           # Reusable WPF controls
β”œβ”€β”€ Converters/         # XAML value converters
β”œβ”€β”€ Data/              # Repository and data access
β”œβ”€β”€ Extensions/        # C# extension methods
β”œβ”€β”€ Interfaces/        # Service contracts
β”œβ”€β”€ Models/           # Data models and DTOs
β”œβ”€β”€ Resources/        # Icons, images, assets
β”œβ”€β”€ Services/         # Service implementations
β”œβ”€β”€ Themes/          # Application themes and styles
β”œβ”€β”€ Validators/      # FluentValidation validators
β”œβ”€β”€ ViewModels/      # MVVM ViewModels
β”œβ”€β”€ Views/           # XAML views and code-behind
└── scripts/         # Build and utility scripts

Each folder contains a README.md explaining its purpose and usage patterns.

πŸ› οΈ Prerequisites

  • .NET 9.0 SDK or later
  • Visual Studio 2022 / VS Code / Rider
  • Windows 10/11

πŸš€ Quick Start

1. Clone or Download

git clone https://github.com/yourusername/WPFBase.git
cd WPFBase

2. Build and Run

# Restore packages
dotnet restore

# Build the project
dotnet build

# Run the application
dotnet run

3. Create Your First Feature

Create a ViewModel:

public partial class MyViewModel : ViewModelBase
{
    private readonly IDialogService _dialogService;

    public MyViewModel(IDialogService dialogService)
    {
        _dialogService = dialogService;
        Title = "My Feature";
    }

    [ObservableProperty]
    private string message = "Hello World!";

    [RelayCommand]
    private async Task ShowMessageAsync()
    {
        await _dialogService.ShowInformationAsync(Message, "Info");
    }
}

Create a View:

<UserControl x:Class="WPFBase.Views.MyView">
    <StackPanel Margin="20">
        <TextBox Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
        <Button Content="Show Message" Command="{Binding ShowMessageCommand}" />
    </StackPanel>
</UserControl>

Register in DI Container (App.xaml.cs):

services.AddTransient<MyViewModel>();
services.AddTransient<MyView>();

πŸ”§ Key Technologies

  • CommunityToolkit.Mvvm 8.4.0 - Modern MVVM with source generators
  • AvalonDock - Professional docking windows
  • Serilog - Structured logging
  • FluentValidation - Business rule validation
  • WPF-UI - Modern UI components
  • xUnit + Moq - Comprehensive testing

πŸ“š Architecture Patterns

MVVM with Source Generators

Uses modern CommunityToolkit.Mvvm patterns:

  • [ObservableProperty] for automatic property generation
  • [RelayCommand] for automatic command generation
  • ObservableValidator for validation support

Service Layer

All services follow interface-based design:

  • Easy to test with mocking
  • Dependency injection throughout
  • Clear separation of concerns

Navigation & Dialogs

Type-safe navigation and comprehensive dialog system:

// Navigate to a view
await _navigationService.NavigateToAsync<CustomerViewModel>();

// Show dialogs
await _dialogService.ShowInformationAsync("Message", "Title");
var result = await _dialogService.ShowConfirmationAsync("Are you sure?");

πŸ§ͺ Testing

The framework includes comprehensive unit tests:

# Run all tests
dotnet test

# Run with coverage
dotnet test /p:CollectCoverage=true

# Run specific tests
dotnet test --filter "NavigationServiceTests"

πŸ“– Documentation

Each folder contains detailed README files explaining:

  • Purpose and usage
  • Code examples
  • Best practices
  • Common patterns

🎯 Use Cases

This framework is perfect for:

  • Enterprise desktop applications
  • Document-based applications (with docking)
  • Configuration tools and utilities
  • Data management applications
  • Rapid prototyping with production-ready code

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

πŸ“„ License

MIT License - Use freely in commercial and open-source projects.

πŸ†˜ Support

  • Documentation: Check folder README files for detailed usage
  • Issues: Report bugs and feature requests in GitHub Issues
  • Examples: See the included sample ViewModels and Views

Built with modern .NET practices for robust, maintainable WPF applications.

About

this project makes it easy to create wpf projects using claude code cli and extensions in VSCode

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •