Autofac如何绑定BindableProperty?
创始人
2024-11-12 11:30:35
0

AutowirePartialView Bindable Property已经被弃用,可以使用AutoFac来绑定Bindable Property。以下是绑定Bindable Property的示例代码:

public class SomeViewModel : BindableObject
{
    // Bindable Property
    public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(
        "ItemsSource", typeof(IEnumerable), typeof(SomeViewModel), null, BindingMode.Default, null, null, null, null);

    public IEnumerable ItemsSource
    {
        get => (IEnumerable)GetValue(ItemsSourceProperty);
        set => SetValue(ItemsSourceProperty, value);
    }

    // AutoFac注册Bindable Property
    public static void Register(ContainerBuilder builder)
    {
        builder.RegisterType()
            .PropertiesAutowired()
            .OnActivated(x =>
            {
                // 设置Bindable Property
                x.Instance.ItemsSource = new List { "item1", "item2", "item3" };
            });
    }
}

相关内容

热门资讯

透视好牌"皇豪互娱科... 透视好牌"皇豪互娱科技软件"开挂(透视)wepoker作弊视频(真实有挂);大家肯定在之前或者中玩过...
带你了解"皮皮胡子辅... 带你了解"皮皮胡子辅助"开挂(透视)哈糖大菠萝可以开挂吗(有挂实锤);最新版2026是一款经典耐玩的...
最新技巧"拱趴大菠萝... 最新技巧"拱趴大菠萝辅助"开挂(透视)wepoker代打辅助(有挂细节);拱趴大菠萝辅助是一项拱趴大...
必备辅助推荐"微信小... 必备辅助推荐"微信小程序家长大贰辅助工具"开挂(透视)pokermaster修改器(有挂教程);1、...
揭秘"hhpoker... 揭秘"hhpoker底牌透视脚本"开挂(透视)wepoker插件功能辅助器(有挂方略);小薇(透视辅...
我来教教大家"蜜瓜大... 我来教教大家"蜜瓜大厅辅助下载"开挂(透视)wejoker私人辅助软件(有挂秘诀);蜜瓜大厅辅助下载...
透视科技"新道游智能... 透视科技"新道游智能辅助器"开挂(透视)wepoker有辅助器吗(有挂细节);1、超多福利:超高返利...
透视黑科技"福州十八... 透视黑科技"福州十八扑外卦视频"开挂(透视)fishpoker透视底牌(有挂方式);福州十八扑外卦视...
分辨真假"衢州都莱软... 分辨真假"衢州都莱软件辅助器"开挂(透视)hhpoker为什么一直输(有挂教程);1、完成的残局,帮...
详细说明"宝宝浙江游... 详细说明"宝宝浙江游戏真的有辅助嘛"开挂(透视)wepoker可以免费玩吗(真是有挂);最新版本免费...