1

I have been looking all over the internet and I cannot find how to create a library with avalonia controls (to be used in other projects).

  1. what type of project do I need to start (in the templates I do not see anything like an avalonia (control) library (don't think it is resources dictionary, would be weird)) ?

  2. if it is just a standard library, what are the required nuget packages (currently desktop only needed) ?

  3. where do I put the compiled dlls best in the using project ?

I'm using Avalonia preview 11.4 on Windows 11.

Geertie
  • 237
  • 4
  • 15
  • If I remember well, in the past there was a template 'Avalonia Class Library' and that would be what to use, but I uninstalled and reinstalled the templates several times and no such template to find ... – Geertie Jan 26 '23 at 09:50
  • 1
    All that is doing is creating a normal class library project and adding the Avalonia references for you. So just do it manually. – Jammer Feb 10 '23 at 07:16
  • 1
    OK @Jammer thanks, I will give that a go, maybe someone can add that to the docs. In any real world app one creates such libraries for future reuse of controls. – Geertie Feb 11 '23 at 16:42
  • 1
    To be honest that's all a template is ever is really. It might have some boilerplate classes. Have you read the docs on installing templates on the AvaloniaUI site? – Jammer Feb 12 '23 at 07:51
  • 1
    Thanks. I had read it and installed and uninstalled the templates several times. That was why I asked the question. For none WPF guru's, like myself, coming from other environments (javaFX, QT, delphi, WinForms) but needing cross-platform UI on top of c# we are forced towards avalonia, it is the only working one at the moment, MAUI is still a joke. I have the feeling that too much of the time the community does not understand that guys like myself are willing to learn (I followed several WPF courses to understand avalonia better), but we will ask questions like these due to lack of background. – Geertie Feb 12 '23 at 09:38
  • 1
    Have a read of my write up article ... https://www.jammer.biz/porting-wpf-to-avaloniaui/ – Jammer Feb 12 '23 at 10:22
  • 1
    Just read and commented your article @jammer, very nice and the search is recognizable ! Should be standard lecture for both newbies and WPF coders coming to avalonia. I expect that things will get smoother for newbies when avalonia 11 will be officially released and more and more tutorials specifically for avalonia (not WPF) will come available online. I recently watched the series of AngelSix on youtube and that was/is a great help ! – Geertie Feb 12 '23 at 13:07
  • Much appreciated. I replied too! :) – Jammer Feb 12 '23 at 16:33

1 Answers1

0

You only need to create an Avalonia.net app, not MVVM, not cross-platform; you can use the following: Custom control: for no existing Controls or for extending functionality to the current Controls. Template controls: for adding styles or grouping to existing or custom Controls. User Controls: for views or complex components in your app, I prefer views. Windows: for new Windows XD

In your case more useful templated controls, and adding that project as reference into new project and ready is easy, I am creating a Avalonia Course if you are interested

hackemate
  • 520
  • 4
  • 12