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辅助器... 透视好友!wepoker辅助器软件下载(透视)都是存在有挂(详细辅助AI教程)1、玩家可以在软件透明...
解密关于!wepoker科技辅... 解密关于!wepoker科技辅助器,德州圈脚本,必胜教程(有挂透视);wepoker科技辅助器软件透...
透视新版!拱趴大菠萝作弊方法(... 透视新版!拱趴大菠萝作弊方法(透视)其实是有挂(详细辅助总结教程)1、系统规律教程、辅助透视等服务,...
一分钟快速了解!德普之星辅助器... 一分钟快速了解!德普之星辅助器怎么用,约局吧游戏挂,线上教程(有挂神器)是一款可以让一直输的玩家,快...
辅助透视!wepoker有脚本... 辅助透视!wepoker有脚本吗(透视)竟然有挂(详细辅助wpk教程);1、用户打开应用后不用登录就...
教程辅助!hhpoker脚本,... 教程辅助!hhpoker脚本,聚星ai辅助工具下载,玩家教你(有挂辅助);致您一封信;亲爱聚星ai辅...
透视规律!hhpoker可以开... 透视规律!hhpoker可以开挂吗(透视)一直真的有挂(详细辅助技巧教程)1、下载好辅助软件之后点击...
透视线上!aapoker插件(... 透视线上!aapoker插件(透视)原来真的是有挂(详细辅助总结教程)1、在ai机器人技巧中,中转单...
记者揭秘!大菠萝手游辅助,po... 记者揭秘!大菠萝手游辅助,poker world辅助,wepoke教程(有挂神器);科技安装教程;1...