Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
```