Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avaloniautils/showmethexaml.avalonia
A Avalonia control making it easy to show the corresponding XAML for custom styles and controls
https://github.com/avaloniautils/showmethexaml.avalonia
avalonia avaloniaui csharp-sourcegenerator
Last synced: about 1 month ago
JSON representation
A Avalonia control making it easy to show the corresponding XAML for custom styles and controls
- Host: GitHub
- URL: https://github.com/avaloniautils/showmethexaml.avalonia
- Owner: AvaloniaUtils
- License: apache-2.0
- Created: 2021-02-23T15:17:11.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-26T14:43:18.000Z (7 months ago)
- Last Synced: 2024-04-26T15:04:17.340Z (7 months ago)
- Topics: avalonia, avaloniaui, csharp-sourcegenerator
- Language: C#
- Homepage:
- Size: 186 KB
- Stars: 28
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ShowMeTheXaml.Avalonia
An Avalonia component making it easy to show the corresponding XAML for custom styles and controls. It was built out of a
need to shows the XAML for the theme library [Material.Avalonia](https://github.com/AvaloniaCommunity/Material.Avalonia).## Getting started
1. Install `ShowMeTheXaml.Avalonia.Generator` [nuget package](https://www.nuget.org/packages/ShowMeTheXaml.Avalonia.Generator/):
```shell
dotnet add package ShowMeTheXaml.Avalonia.Generator
```
This will also install the `ShowMeTheXaml.Avalonia` [nuget package](https://www.nuget.org/packages/ShowMeTheXaml.Avalonia/) as well.2. Add XamlDisplay style to your app in `App.xaml`. See the example of `App.xaml`:
```xaml
...
...
...
```3. Initialize `DisplayContent` dictionary in `XamlDisplay` class:
Add `UseXamlDisplay()` in `Program.cs` to `BuildAvaloniaApp` method. It should look like this:
```c#
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure()
.UsePlatformDetect()
.LogToTrace()
// This line \/
.UseXamlDisplay()
// This line /\
.UseReactiveUI();
```
Or call `XamlDisplayInternalData.RegisterXamlDisplayData()` on your program startup.4. Add `XamlDisplay` in your xaml. Set unique `UniqueId` property value. Example:
```xaml
```---
# ShowMeTheXaml.Avalonia.AvaloniaEdit
Style for displaying xaml content inside [AvaloniaEdit (AvalonEdit)](https://github.com/AvaloniaUI/AvaloniaEdit)
## Getting started
Refer to usual [getting started](https://github.com/AvaloniaUtils/ShowMeTheXaml.Avalonia#getting-started) **but:**
1. Instead `ShowMeTheXaml.Avalonia` use (install) `ShowMeTheXaml.Avalonia.AvaloniaEdit` [nuget package](https://www.nuget.org/packages/ShowMeTheXaml.Avalonia.AvaloniaEdit/)
```shell
dotnet add package ShowMeTheXaml.Avalonia.AvaloniaEdit
```
2. Use another style. Instead
```xaml
```
use
```xaml
```Everything else remains the same.
---
# Compiling sources
1. Clone this repo:
```shell
git clone https://github.com/AvaloniaUtils/ShowMeTheXaml.Avalonia.git
```2. Navigate to repo folder
3. Fetch all submodules:
```shell
git submodule update --init --recursive
```4. Compile project:
```shell
dotnet build
```