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" };
            });
    }
}

相关内容

热门资讯

透视肯定"wepok... 透视肯定"wepoker能不能透视"详细辅助透明挂教程(私人局规律方法)是一款可以让一直输的玩家,快...
透视安卓版"德普之星... 1、透视安卓版"德普之星私人局辅助免费"详细辅助2025新版技巧(透视app下载神器);详细教程。2...
透视好友房"poke... 1、透视好友房"pokemomo辅助软件"详细辅助新2025版(轻量版透视方法透明);详细教程。2、...
透视透视挂"wepo... 透视透视挂"wepoker代打辅助"详细辅助玩家教程(破解器激活码攻略)是一款可以让一直输的玩家,快...
透视软件"wepok... 透视软件"wepoker钻石怎么看底牌"详细辅助2025新版(免费透视脚本辅助);最新版2024是一...
透视存在"wepok... 1、透视存在"wepoker怎么设置房间"详细辅助安装教程(新号好一点透明)。2、wepoker怎么...
透视中牌率"wepo... 1、透视中牌率"wepoker私人局规律"详细辅助AI教程(辅助器安装包软件);详细教程。2、wep...
透视app"poke... 1、透视app"pokermaster破解版"详细辅助力荐教程(软件方法);详细教程。2、poker...
透视辅助"wepok... 透视辅助"wepoker轻量版透视方法"详细辅助详细教程(到底有透视技巧);最新版2024是一款经典...
透视教学"德州透视插... 透视教学"德州透视插件"详细辅助高科技教程(模拟器哪个好用辅助);最新版2024是一款经典耐玩的益智...