WinUI 3 Calculator

January 1, 2026 ยท View on GitHub

A modern, open-source Windows calculator built with WinUI 3, featuring MVVM architecture, Fluent Design System, and full keyboard support.

Windows .NET License

Features

  • ๐Ÿงฎ Full Calculator Operations - Addition, subtraction, multiplication, division, percentage
  • ๐Ÿ”ข Advanced Functions - Square root, square, reciprocal, negate
  • โŒจ๏ธ Complete Keyboard Support - Use numpad or keyboard for fast input
  • ๐ŸŽจ Fluent Design - Electric Blue accent with Mica backdrop
  • ๐ŸŒ™ Dark/Light Theme - Follows Windows system theme automatically
  • โ™ฟ Accessible - Full keyboard navigation, screen reader support
  • ๐Ÿ“‹ Clipboard Integration - Right-click to copy results

Screenshots

Coming soon

Requirements

Getting Started

Clone the Repository

git clone https://github.com/YOUR_USERNAME/winui-calculator.git
cd winui-calculator

Build and Run

dotnet build
dotnet run

Run Tests

dotnet test calculator.Tests

Project Structure

calculator/
โ”œโ”€โ”€ Commands/
โ”‚   โ””โ”€โ”€ RelayCommand.cs           # ICommand implementation for MVVM
โ”œโ”€โ”€ Helpers/
โ”‚   โ””โ”€โ”€ ServiceLocator.cs         # Lightweight dependency injection
โ”œโ”€โ”€ Services/
โ”‚   โ”œโ”€โ”€ ICalculatorEngine.cs      # Calculator logic interface
โ”‚   โ””โ”€โ”€ CalculatorEngine.cs       # Math operations implementation
โ”œโ”€โ”€ ViewModels/
โ”‚   โ””โ”€โ”€ CalculatorViewModel.cs    # Main ViewModel with all commands
โ”œโ”€โ”€ Styles/
โ”‚   โ””โ”€โ”€ CalculatorStyles.xaml     # Button styles, animations, colors
โ”œโ”€โ”€ Views/
โ”‚   โ”œโ”€โ”€ MainPage.xaml             # Calculator UI layout
โ”‚   โ””โ”€โ”€ MainPage.xaml.cs          # Keyboard handling
โ”œโ”€โ”€ calculator.Tests/             # Unit tests (xUnit)
โ”œโ”€โ”€ App.xaml                      # Resource dictionary references
โ””โ”€โ”€ App.xaml.cs                   # Window configuration, Mica backdrop

Architecture

This project follows the MVVM (Model-View-ViewModel) pattern:

  • Model: CalculatorEngine handles all mathematical operations
  • ViewModel: CalculatorViewModel manages UI state and commands
  • View: MainPage.xaml defines the calculator UI
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  MainPage   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚CalculatorViewModelโ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ CalculatorEngine โ”‚
โ”‚   (View)    โ”‚     โ”‚   (ViewModel)     โ”‚     โ”‚    (Service)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      โ”‚                      โ”‚
      โ”‚      x:Bind          โ”‚      ICommand
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Keyboard Shortcuts

KeyAction
0-9Enter digits
.Decimal point
+Add
-Subtract
*Multiply
/Divide
EnterCalculate result
BackspaceDelete last digit
EscapeClear all
DeleteClear entry
Ctrl+CCopy result

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow MVVM pattern
  • Add unit tests for new calculator operations
  • Use Fluent Design guidelines for UI changes
  • Ensure accessibility (AutomationProperties, keyboard navigation)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments