Avalonia : how to create an avalonia control library - avaloniaui

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).
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)) ?
if it is just a standard library, what are the required nuget packages (currently desktop only needed) ?
where do I put the compiled dlls best in the using project ?
I'm using Avalonia preview 11.4 on Windows 11.

Related

.NET 6.0 Windows Control Library No Longer Appears in Toolbox of Winforms Project since 17.3

As of the latest release a solution containing a windows form project no longer shows a windows forms control library in the same solution in the ToolBox.
Here is a sample of the problem. It's a solution with two projects, one is a windows Form Project (called "DemoApp") and a Winforms Control Library Project (called "Brooklyn"), this is a mock up so there is only a blank form and a single control called MyButton which inherits from windows.forms.button in the control library. This was working fine until the latest VS update to 17.3. Both projects Target NET 6.0
Here's a link to the project on my Google drive. Again it's only a simple mockup to demonstrate the issue.
https://drive.google.com/drive/folders/1r2R_7N5ok0Nk4f96UUOdA3Hzzjc2Jfa1?usp=sharing

How to access the GetDoubleClickTime Win32 API function from a WinUI 3.0 Runtime Component library

I'm trying to call the GetDoubleClickTime Win32 API function using C++ from a new project created with the "Windows Runtime Component (WinUI 3)" Visual Studio template.
To do so, I'm adding #include <Windows.h> to the pch.h file and then simply call the mentioned function. However, I'm getting the following compiler error afterwards: error C3861: 'GetDoubleClickTime': identifier not found.
According to the template description, this project should create a library that is both usable in Desktop and UWP apps. I'm aware that the GetDoubleClickTime function cannot be called from UWP. But it has to work for Desktop apps.
How can I make this work?
Apparently it creates a sandboxed UWP project behind the scenes. Please refer to this GitHub issue and see #sylveon's comments at the very bottom of the conversation for a potential fix/workaorund.
You can edit the vcxproj's global PropertyGroup and add these two directives right now to force the UWP project to use the desktop API set, and link the desktop CRT (removing the need to carry around the VCRT forwarders, which are honestly a terrible hack)
<_NoWinAPIFamilyApp>true</_NoWinAPIFamilyApp>
<_VC_Target_Library_Platform>Desktop</_VC_Target_Library_Platform>
Alternatively, it seems that merely setting <AppContainerApplication>false</AppContainerApplication> works as well.

Unable to create a nuget package out of a custom control in xamarin forms

I just created a simple custom control in my xamarin.forms project and want to use the same control as a nuget package in my other projects. After creating the .nupkg file I tested it by adding as a local package in another xamarin forms project.The issue is the package I created is installed,but the contents inside it are not available.. Can anyone help me on resolving this..
You have to tell visual studio to pack the content of a library and generate a nuget package. This will then include the dll in the package and allow you to access it from other projects.
You can see how to do this in Visual Studio here
Including Xaml files is trickier, but if you can do the UI in code it easier enough. I created Xamarin.Forms control library on github that might be a good place to start.

Xamarin Forms code sharing

I'm working on a xamarin forms (PCL) project (A basic customer care chat app which is meant to run on Android and iOS only) that has just two xaml pages, custom renderers and few dependencies. This project is meant to be implemented into another existing project (which I don't have access to its source code) such that an action would be binded to a button on the existing app to show a page on my own project.
There is need for me to share my chat project with my client's developer but without exposing my source codes, perhaps compiling to dll or nuget package that would be added to the existing project to access my project's functions and pages. I have searched through the xamarin forum and here on stackoverflow but can't seem to lay my hands on a solution.
Is this possible at all? If yes, what am I missing? If no, is there any better option to use?
Please do note that the chat app completely done, so I'm hoping perhaps there's a way I could directly convert the project to a Nuget package.
Thanks in anticipation!
If the host application is a Xamarin Forms one:
-Move your cross platform shared code into a PCL or .Net Standard (ContentPages, ContentViews, Classes).
-Move your Renderers and platform specific code to Android and iOs Class Libraries.
Your client will have to reference your first assembly (dll) in their XF assembly in order to instantiate/manipulate your views/classes and platform specifics one on their Back-end side (taking into account your renderers, effects, etc ...)
A lot of Xamarin Controls Libraries Open Source hosted on Github are working like that. For example this one: https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout
If the host application is a native application, take a look into Xamarin forms embedding
Finally, I seem to solve the problem by enabling visual studio to build Nuget packages for the chat app project (summing up to 3 nuget packages) on project build.
Thanks #Rudy Spano and #Micah Switzer for your contributions

how to build xaml ui in Cocos2d for windows 8 metro application?

we have been use cocos2d for windows 8 build metro game . so we want use xaml control UI in cocos2d ?
is there have soluction or suggestion?
just try one night i have been fix this problem. you can click fllow link:
DirectX and XAML interop (Windows Store apps using C++ and DirectX) (Windows) http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx
With the release of Windows 8, you can use XAML and Direct X together in your Windows Store app. The combination of XAML and DirectX lets you build flexible user interface frameworks that interop with your DirectX-rendered content, and is particularly useful for graphics-intensive apps. We explain the structure of a XAML app that uses DirectX, and identify the important types to use when building your XAML app to work with DirectX.
soluction as fllow link:
http://www.cnblogs.com/chenkai/archive/2012/11/29/2794983.html
by chenkai
Here's a template project in my github:
https://github.com/chanyuenpang/cocos2dxaml