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.
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
- Windows 10 (1809+) or Windows 11
- .NET 9.0 SDK
- Windows App SDK
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:
CalculatorEnginehandles all mathematical operations - ViewModel:
CalculatorViewModelmanages UI state and commands - View:
MainPage.xamldefines the calculator UI
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ MainPage โโโโโโถโCalculatorViewModelโโโโโโถโ CalculatorEngine โ
โ (View) โ โ (ViewModel) โ โ (Service) โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ
โ x:Bind โ ICommand
โโโโโโโโโโโโโโโโโโโโโโโโ
Keyboard Shortcuts
| Key | Action |
|---|---|
0-9 | Enter digits |
. | Decimal point |
+ | Add |
- | Subtract |
* | Multiply |
/ | Divide |
Enter | Calculate result |
Backspace | Delete last digit |
Escape | Clear all |
Delete | Clear entry |
Ctrl+C | Copy result |
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - 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
- Built with WinUI 3
- Inspired by the Windows Calculator
- Icons from Segoe Fluent Icons