我可以在Xamarin上使用WPF的全屏用户界面吗?

时间:2021-05-14 10:41:05

I'm thinking about starting to use Xamarin, is it possible to take a full-screen WPF project and use it on iOS and Android ?

我正在考虑开始使用Xamarin,是否有可能采用全屏WPF项目并在iOS和Android上使用它?

4 个解决方案

#1


9  

No. Xamarin.Android and Xamarin.iOS expose the UI of the relevant platforms - you can't just use WPF on them.

没有.Xamarin.Android和Xamarin.iOS公开了相关平台的UI - 你不能只在它们上使用WPF。

However, if you separate out your "business logic" from the UI logic in your application, you may well be able to use the same business logic project, and just create new UI projects (one per platform). Of course, that relies on your "business logic" only requiring functionality which is available on Xamarin; more generally you'd want to create a Portable Class Library with that code in.

但是,如果将“业务逻辑”与应用程序中的UI逻辑分开,则可能能够使用相同的业务逻辑项目,并且只需创建新的UI项目(每个平台一个)。当然,这依赖于您的“业务逻辑”,只需要Xamarin上提供的功能;更一般地说,你想要创建一个带有该代码的可移植类库。

#2


3  

No this is not possible. You have to use the Native API's for User Interface on both IOS and Android when you use Xamarin.

不,这是不可能的。当您使用Xamarin时,您必须在IOS和Android上使用Native API用于用户界面。

You can definitely share a lot of code, but WPF will not work.

你绝对可以分享很多代码,但WPF不会工作。

#3


3  

No. Xamarin relies on each platform's native UI stack. You cannot take a WPF UI (or a Winforms or Silverlight UI) and run it on iOS or Android. What you CAN do is take the underlying core of your WPF project (domain, services, data, business logic) and use Xamarin to create an iOS and/or Android native UI on top of it.

不,Xamarin依赖于每个平台的本机UI堆栈。您无法使用WPF UI(或Winforms或Silverlight UI)并在iOS或Android上运行它。您可以做的是获取WPF项目的基础核心(域,服务,数据,业务逻辑),并使用Xamarin在其上创建iOS和/或Android本机UI。

#4


3  

WPF is only supported on Windows - it's not even supported on other platforms with desktop APIs for Mono.

WPF仅在Windows上受支持 - 在Mono桌面API的其他平台上甚至不支持WPF。

In general, with Xamarin, the approach is you share "logic" code, but use native UI projects for each platform.

通常,使用Xamarin,方法是共享“逻辑”代码,但是为每个平台使用本机UI项目。

#1


9  

No. Xamarin.Android and Xamarin.iOS expose the UI of the relevant platforms - you can't just use WPF on them.

没有.Xamarin.Android和Xamarin.iOS公开了相关平台的UI - 你不能只在它们上使用WPF。

However, if you separate out your "business logic" from the UI logic in your application, you may well be able to use the same business logic project, and just create new UI projects (one per platform). Of course, that relies on your "business logic" only requiring functionality which is available on Xamarin; more generally you'd want to create a Portable Class Library with that code in.

但是,如果将“业务逻辑”与应用程序中的UI逻辑分开,则可能能够使用相同的业务逻辑项目,并且只需创建新的UI项目(每个平台一个)。当然,这依赖于您的“业务逻辑”,只需要Xamarin上提供的功能;更一般地说,你想要创建一个带有该代码的可移植类库。

#2


3  

No this is not possible. You have to use the Native API's for User Interface on both IOS and Android when you use Xamarin.

不,这是不可能的。当您使用Xamarin时,您必须在IOS和Android上使用Native API用于用户界面。

You can definitely share a lot of code, but WPF will not work.

你绝对可以分享很多代码,但WPF不会工作。

#3


3  

No. Xamarin relies on each platform's native UI stack. You cannot take a WPF UI (or a Winforms or Silverlight UI) and run it on iOS or Android. What you CAN do is take the underlying core of your WPF project (domain, services, data, business logic) and use Xamarin to create an iOS and/or Android native UI on top of it.

不,Xamarin依赖于每个平台的本机UI堆栈。您无法使用WPF UI(或Winforms或Silverlight UI)并在iOS或Android上运行它。您可以做的是获取WPF项目的基础核心(域,服务,数据,业务逻辑),并使用Xamarin在其上创建iOS和/或Android本机UI。

#4


3  

WPF is only supported on Windows - it's not even supported on other platforms with desktop APIs for Mono.

WPF仅在Windows上受支持 - 在Mono桌面API的其他平台上甚至不支持WPF。

In general, with Xamarin, the approach is you share "logic" code, but use native UI projects for each platform.

通常,使用Xamarin,方法是共享“逻辑”代码,但是为每个平台使用本机UI项目。