如何将 C# - Xaml - Visual Studio 项目转换为 Xamarin 项目

How to convert C# - Xaml - Visual Studio Project to Xamarin project

我已经完成了 XAML 项目。我想将它转换为 xamarin 项目。这样我就可以为我的项目获得跨平台支持。有什么办法或者我应该在 xamarin 中从头开始编码吗?

如果您一直在使用 WPF,我建议您重新开始。 虽然命名非常相似,但只是复制和粘贴而已。还控制 命名相同将表现不同。

此外,外观和感觉与您在桌面上实现它的方式大不相同,因此请将此视为重新考虑的好机会。

根据您构建底层代码的方式,您可能能够重用(大部分)业务逻辑甚至视图模型,因此在这种情况下,您只需为您的应用程序构建另一个视图,即使用 MVVM 模式的优点之一,就像你说的那样。

看看这个 link,它描述了 WPF 和 Xamarin.Forms XAML 之间的一些差异。

引自引言:

As a WPF developer this is great news. I can transfer all my skills across to Xamarin Forms and write cross-platform natively backed UI’s. However, it’s not a direct transfer. There are differences, in much the same way that there were differences between Silverlight and WPF. But these go much deeper.

尽管这篇博文中的一些陈述不再有效。从那时起 Xamarin.Forms 已经走了很长一段路。

在此 blogpost 中,您可以看到与 XAML 的一些实际差异以及它们的行为方式不同。