【问题标题】:Xamarin Forms XAML Design InstanceXamarin 表单 XAML 设计实例
【发布时间】:2019-08-01 01:27:16
【问题描述】:

有没有办法在 Xamarin Forms XAML 页面中启用设计上下文以启用智能感知?它在 WPF 中工作,但多年来我无法让它在 Xamarin Forms 中工作。

【问题讨论】:

    标签: forms xaml xamarin


    【解决方案1】:

    因此,如果您通过在代码中某处设置属性来编译 xaml,然后在下面包含 xaml sn-p,则可以使用设计时数据上下文并获得智能感知。

    [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
    namespace MySpace
    {
       public partial class App {}  
    }
    
    <Page
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d ="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d"             
    d:DataContext="{d:DesignInstance Type=list:TestViewModel}"
    xmlns:list="clr-namespace:PolyhydraGames.Test.ViewModels"
    .../>
    

    【讨论】:

      【解决方案2】:

      通常你应该默认得到它。否则试试Ctrl + Space。您不需要任何额外的代码。请注意,它不会显示绑定对象的强度,而是显示所有设计时元素。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-06-21
        • 2017-11-27
        • 2016-12-22
        • 2023-03-04
        • 2017-12-14
        • 1970-01-01
        • 2015-05-13
        • 1970-01-01
        相关资源
        最近更新 更多