AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.85k stars 2.24k forks source link

Multi-DLL support needed for views #17051

Open WillPittenger opened 1 month ago

WillPittenger commented 1 month ago

Is your feature request related to a problem? Please describe.

My app needs some abstraction layers so 3rd parties later can come in and add support for more communications protocols. I'm working on one for IRC. We're hoping to add Discord and Matrix support later. But the 3rd party issue means my app can't be one monolithic assembly. Instead, each protocol developer needs to supply their own back end. Plus, we want to support several different front ends. I'm working on a desktop only front end. There will be others specific to phones and a web client. Plus, some IRC users like TUI front ends.

All that means they have to implement their own Avalonia-based front ends in their DLL. I can't provide them as I won't know what they'll need. Unfortunately, when I put my IRC controls and windows in a second DLL, Avalonia seems to break down. The first and main symptom I keep seeing is how when I edit AXAML pages not in my main assembly, IntelliSense seems unavailable.

I should also note in such situations, the preview pane is unavailable and might as well be hidden. Relying on a main assembly for that is a real pain. Between these things, I doubt my project will get much further as an Avalonia-based project. I do, however, like Avalonia for its theme support and portability. (We need *nix and MacOS support.)

Describe the solution you'd like

I don't know what the solution would be as I don't know how Avalonia works in the meantime. But I do need the option to put controls and windows in DLLs that aren't my main assembly.

I should note that having a property editor like Windows Forms and WPF have would help you convince people to switch. I consider the Windows Forms editor to be slighter superior as coders could quickly enter a single value for a margin.

Another thing to help people decide would be to preview based on the AXAML when the executables aren't available. Just put up a warning the preview might not be accurate as it's based only on controls it has and the attributes in the AXAML.

Describe alternatives you've considered

As noted, I originally started with WPF. But when I saw Avalonia, I was hopeful it'd do the job. But as is, it needs help.

Additional context

If you want to see what I have now, take a look at my latest code. This shows what I did in WPF.

thevortexcloud commented 1 month ago

IntelliSense seems unavailable.

It's probably worth mentioning what IDE you use. Visual Studio's support for Avalonia is significantly more simplistic than Rider's (mainly because Jetbrains officially supports Avalonia while Visual Studio does not). If you use Resharper in Visual Studio, it will work identically to Rider as well.

I should note that having a property editor like Windows Forms and WPF have would help you convince people to switch. I consider the Windows Forms editor to be slighter superior as coders could quickly enter a single value for a margin.

There is a designer coming as a paid feature.

https://github.com/AvaloniaUI/Avalonia/discussions/16997

WillPittenger commented 1 month ago

We don't have any funds. Se JetBrains is out. I'm using VS 2022.

thevortexcloud commented 1 month ago

You can often use Jetbrains products for free, as long as you are willing to be a beta tester. EG

https://www.jetbrains.com/rider/nextversion/

They do shut it down though for a few weeks after the stable version is released before the next EAP is opened. But it will at least let you check if what you are experiencing is a Visual Studio specific problem.

Also:

Another thing to help people decide would be to preview based on the AXAML when the executables aren't available.

That probably wont work, at least with how the previewer currently works. Which is by executing your actual app code (you can easily see that if you make it load an external resource) inside a special backend. As such if the app can't be compiled, the preveiwer also can't function.

WillPittenger commented 1 month ago

I'd have to think about that. Betas in general aren't the most reliable. Plus, while I'm currently the only developer, I'm hoping that won't last as I know zilch about how these protocols work behind the scenes.