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

相关内容

热门资讯

三分钟了解!wpk辅助器,hh... 1、三分钟了解!wpk辅助器,hhpoker免费辅助器,必赢教程(有挂神器);详细教程。2、hhpo...
玩家必看攻略!wejoker私... 玩家必看攻略!wejoker私人辅助软件,智星德州可以透视吗,透明挂教程(有挂技巧)关于智星德州可以...
程序员教你!hh poker透... 程序员教你!hh poker透视器下载,hhpoker的辅助是真的吗,必胜教程(有挂教程);致您一封...
科普攻略!aapoker怎么选... 科普攻略!aapoker怎么选牌,wepoker辅助器激活码,透明挂教程(有挂软件);亲真的是有正版...
玩家必备教程!德州透视插件,w... 这是一款非常优秀的wejoker黑侠辅助器 ia辅助检测软件,能够让你了解到wejoker黑侠辅助器...
记者揭秘!wepoker私局代... 记者揭秘!wepoker私局代打,安装不了wepoker,安装教程(有挂攻略)准备好在wepoker...
教学盘点!德普之星透视,hhp... 教学盘点!德普之星透视,hhpoker到底可以作弊码,新2025教程(有挂技巧);hhpoker到底...
终于知道!哈糖大菠萝万能挂,聚... 1、终于知道!哈糖大菠萝万能挂,聚星ai辅助工具激活码,必赢教程(有挂神器)(UU poker、聚星...
玩家必看科普!werplan免... 1、玩家必看科普!werplan免费挂下载,hh poker软件,我来教教你(有挂教程);详细教程。...
玩家必看教程!hhpoker俱... 玩家必看教程!hhpoker俱乐部是干嘛的,aapoker脚本,科技教程(有挂攻略);hhpoker...