预览 Xamarin 表单页面

Preview Xamarin Form Pages

有没有什么方法可以在不首先部署到 device/emulator 的情况下预览 Xamarin 表单页面?

或者有什么方法可以实时编辑页面并查看某处的更改(有点像 WPF 的史努比)。 我尝试了 Xamarin Studio + Visual Studio,但没有看到设计器。

2016 年 9 月 30 日更新:

使用最新版本的 Xamarin 可以使用以下步骤:

使用视图 > 其他Windows > Xamarin.Forms 预览器 Visual Studio 中的菜单打开预览 window。使用 Window > New Vertical Tab Group 菜单 将其并排放置,如下图所示:

注意:

The previewer requires that the project be built before rendering a page. If the error 'Invalid XAML' appears at the top of the preview pane, re-build the application and try again.

Source

旧答案供其他解决方案参考:

Xamarin.Forms 预览器目前仅在 Alpha 频道的 Xamarin Studio 中可用。 Follow these instructions to change the update channel.

目前没有官方 Xamarin Forms UI visual studio 预览器。然而在上一届 Xamarin Evolve 2016 中,Xamarin 宣布他们正在开发一款即将发布的设计器。应该是 announced.

Xamarin recently released a Xamarin Previewer, for Xamarin Studio only (Visual Studio to come later) that lets you preview XAML on iOS and Android. This is currently in preview and available via the Alpha channel (29th April 2016). I will try to remember to update this once it comes out for Visual Studio.

作为非官方的替代品,您可以尝试:

Gorilla Player

Xamarin Studio 确实包含一个 XAML 预览器,我已经使用它一段时间了。

https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-previewer/

Xamarin.Forms 预览器可在 稳定频道 中作为预览版使用。

项目需要最新的 Xamarin.Forms NuGet 包才能使 XAML 预览器工作。

打开 Android SDK 管理器并更新 SDK 工具和平台工具

重建解决方案并创建新的 xaml 页面。

在Visual Studio中: 使用视图 > 其他 Windows > Xamarin.Forms 预览器菜单打开预览 window。 Et voilà

https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-previewer/

Xamarin.Forms 预览器现在可在 VS 中使用。您需要做的就是更新您的 Xamarin 版本:Tools > Options > Xamarin > 其他 > 立即检查 将您的 Xamarin 更新到最新版本。

然后通过View > Other Windows > Xamarin.Forms Previewer

更新:但它似乎没有显示我的 XAML 的任何内容!

在我自己对该主题进行研究后,我留下了 here 我的印象,尝试过:

  1. Xamarin 的预览器
  2. Xamarin 表单播放器
  3. 大猩猩玩家

底线

我决定使用 Gorilla Player。唯一真正与我合作的人——尽管它有只能使用 XAML 的限制——这意味着你被迫使用 XAML.

来编写你的 UI