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

相关内容

热门资讯

开挂辅助插件"wep... 开挂辅助插件"wepoker透视有用吗"开挂(透视)辅助下载(确实有挂)wepoker透视有用吗ai...
开挂辅助软件"wep... 开挂辅助软件"wepoker开辅助能查到吗"开挂(透视)辅助下载(有挂透视);wepoker开辅助能...
开挂辅助下载"wpk... 开挂辅助下载"wpk俱乐部是真的吗"开挂(透视)辅助脚本(确实有挂) 【无需打开直接搜索加薇1367...
开挂辅助下载"pok... 开挂辅助下载"pokemmo辅助器"开挂(透视)辅助下载(竟然有挂);无需打开直接搜索加薇13670...
开挂辅助平台"德州局... 开挂辅助平台"德州局怎么透视"开挂(透视)辅助脚本(有挂头条)您好:德州局怎么透视这款游戏可以开挂,...
开挂辅助安装"德普之... 大家好,今天小编来为大家解答德普之星透视辅助这个问题咨询软件客服可以免费测试直接加微信(136704...
开挂辅助安装"hhp... hhpoker软件可以玩吗开挂教程视频分享装挂详细步骤在当今的网络游戏中,hhpoker软件可以玩吗...
开挂辅助脚本"wep... wepoker轻量版辅助 无需打开直接搜索微信:136704302本司针对手游进行,选择我们的四大理...
开挂辅助插件"hh ... hh poker软件开挂教程视频分享装挂详细步骤在当今的网络游戏中,hh poker软件作为一种经典...
开挂辅助脚本"aap... 较多好评“微乐万能挂官网”开挂(透视)辅助教程 了解更多开挂安装加(136704302)微信号是一款...