Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/havendv/viewbasegenerator
Generates boiler-plate code for constructors or ViewBase classes for WPF/UWP/WinUI/Uno projects.
https://github.com/havendv/viewbasegenerator
code-generator constructors generator initializecomponent source-generator uno uno-platform uwp viewbase winui winui3 wpf
Last synced: 19 days ago
JSON representation
Generates boiler-plate code for constructors or ViewBase classes for WPF/UWP/WinUI/Uno projects.
- Host: GitHub
- URL: https://github.com/havendv/viewbasegenerator
- Owner: HavenDV
- License: mit
- Created: 2021-10-17T05:55:18.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-19T08:55:44.000Z (12 months ago)
- Last Synced: 2024-10-06T09:23:00.355Z (about 1 month ago)
- Topics: code-generator, constructors, generator, initializecomponent, source-generator, uno, uno-platform, uwp, viewbase, winui, winui3, wpf
- Language: C#
- Homepage:
- Size: 276 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ViewBaseGenerator
The main purpose of the generator is to avoid boilerplate code in the code-behind views files, like this:
```cs
public partial class MainPage
{
public MainPage()
{
InitializeComponent();
}
}
```At the same time, the generator supports the ability to add your code anywhere through the definition of partial methods for special cases:
```cs
public partial class MainPage
{
partial void BeforeInitializeComponent();
partial void AfterInitializeComponent();public MainPage()
{
BeforeInitializeComponent();InitializeComponent();
AfterInitializeComponent();
}
}
```I also recommend not deleting .xaml.cs files, but leaving them empty like this:
```cs
namespace YourNamespace.Views;public partial class MainView
{
}
```## Nuget
[![NuGet](https://img.shields.io/nuget/dt/ViewBaseGenerator.svg?style=flat-square&label=ViewBaseGenerator)](https://www.nuget.org/packages/ViewBaseGenerator/)
```
Install-Package ViewBaseGenerator
```### WPF/UWP/WinUI
```xml
YourNamespace.Views
```### Uno (projects besides UWP/WinUI)
Uno uses Source Generators and there is currently no way to use the output of one generator in another.
Therefore, the solution is somewhat more complicated:
1. Create new project like this:
```xml
netstandard2.0;net6.0-android;net6.0-ios;net6.0-macos;net6.0-maccatalyst
YourNamespace.Views
all
runtime; build; native; contentfiles; analyzers; buildtransitive
```
2. Add this project reference to your apps.## Contacts
* [mail](mailto:[email protected])