private static void RegisterCollectionViewMembers(IBindingMemberProvider memberProvider)
        {
            BindingServiceProvider.ResourceResolver.AddType("UICollectionViewScrollPosition", typeof(UICollectionViewScrollPosition));
            BindingServiceProvider.ResourceResolver.AddType("UICollectionViewScrollDirection", typeof(UICollectionViewScrollDirection));

            BindingServiceProvider.BindingMemberPriorities[CollectionViewUseAnimationsMember.Path]  = 1;
            BindingServiceProvider.BindingMemberPriorities[CollectionViewScrollPositionMember.Path] = 1;

            //UICollectionView
            memberProvider.Register(CollectionViewUseAnimationsMember);
            memberProvider.Register(CollectionViewScrollPositionMember);
            memberProvider.Register(CollectionViewSelectedItemChangedEvent);
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <UICollectionView, IEnumerable>(AttachedMemberConstants.ItemsSource, CollectionViewItemsSourceChanged));
            memberProvider.Register(AttachedBindingMember.CreateMember <UICollectionView, object>(AttachedMemberConstants.SelectedItem,
                                                                                                  GetCollectionViewSelectedItem, SetCollectionViewSelectedItem, (info, view, arg3) => (IDisposable)CollectionViewSelectedItemChangedEvent.SetValue(view, arg3)));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <UICollectionView, ICollectionCellTemplateSelector>(
                                        AttachedMemberConstants.ItemTemplate,
                                        (view, args) =>
            {
                if (args.NewValue != null)
                {
                    args.NewValue.Initialize(view);
                }
            }));

            //UICollectionViewCell
            memberProvider.Register(CollectionViewCellSelectedMember);
            memberProvider.Register(CollectionViewCellHighlightedMember);
            memberProvider.Register(CollectionViewCellShouldHighlightMember);
            memberProvider.Register(CollectionViewCellShouldDeselectMember);
            memberProvider.Register(CollectionViewCellShouldSelectMember);
        }
        public void AutoPropertyGenericDefaultValueTest()
        {
            string       defaultValue = "test";
            bool         isInvoked    = false;
            var          source       = new BindingSourceModel();
            const string path         = "path";
            var          property     = AttachedBindingMember.CreateAutoProperty <BindingSourceModel, string>(path, null, null, (o, info) =>
            {
                isInvoked = true;
                o.ShouldEqual(source);
                info.ShouldNotBeNull();
                return(defaultValue);
            });

            property.GetValue(source, null).ShouldEqual(defaultValue);
            isInvoked.ShouldBeTrue();

            isInvoked = false;
            property.GetValue(source, null).ShouldEqual(defaultValue);
            isInvoked.ShouldBeFalse();

            source       = new BindingSourceModel();
            defaultValue = path;
            property.GetValue(source, null).ShouldEqual(defaultValue);
            isInvoked.ShouldBeTrue();
        }
 static AttachedMembersRegistration()
 {
     DebbugerAttached         = Debugger.IsAttached;
     ExplicitParentTypes      = new HashSet <Type>();
     CommandParameterInternal = AttachedBindingMember.CreateAutoProperty <object, object>("~#@cmdparam");
     AttachedParentMember     = AttachedBindingMember.CreateAutoProperty <object, ParentValue>("#" + AttachedMemberConstants.Parent);
 }
 private static void RegisterViewMembers(IBindingMemberProvider memberProvider)
 {
     //View
     memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.View.Fragment));
     memberProvider.Register(AttachedBindingMember.CreateMember <View, object>(AttachedMemberConstants.FindByNameMethod, ViewFindByNameMember));
     memberProvider.Register(AttachedBindingMember.CreateMember <View, object>(AttachedMemberConstants.Parent, GetViewParentValue, SetViewParentValue, ObserveViewParent));
     memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>(AttachedMemberConstants.Focused,
                                                                             (info, view) => view.IsFocused, (info, view, arg3) =>
     {
         if (arg3)
         {
             view.RequestFocus();
         }
         else
         {
             view.ClearFocus();
         }
     }, "FocusChange"));
     memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>(AttachedMemberConstants.Enabled,
                                                                             (info, view) => view.Enabled, (info, view, value) => view.Enabled = value));
     memberProvider.Register(AttachedBindingMember.CreateMember <View, ViewStates>("Visibility",
                                                                                   (info, view) => view.Visibility, (info, view, value) => view.Visibility = value,
                                                                                   ObserveViewVisibility));
     memberProvider.Register(AttachedBindingMember.CreateMember(AttachedMembers.View.Visible,
                                                                (info, view) => view.Visibility == ViewStates.Visible,
                                                                (info, view, value) => view.Visibility = value ? ViewStates.Visible : ViewStates.Gone,
                                                                ObserveViewVisibility));
     memberProvider.Register(AttachedBindingMember.CreateMember(AttachedMembers.View.Hidden,
                                                                (info, view) => view.Visibility != ViewStates.Visible,
                                                                (info, view, value) => view.Visibility = value ? ViewStates.Gone : ViewStates.Visible,
                                                                ObserveViewVisibility));
     memberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, object>(AttachedMembers.Toolbar.MenuTemplate.Path));
     memberProvider.Register(AttachedBindingMember.CreateEvent <View>("WidthChanged", (info, o, arg3) => new SizeObserver(o, arg3)));
     memberProvider.Register(AttachedBindingMember.CreateEvent <View>("HeightChanged", (info, o, arg3) => new SizeObserver(o, arg3)));
 }
        public static void RegisterTableViewMembers()
        {
            BindingServiceProvider.ResourceResolver.AddType(typeof(UITableViewRowAnimation));
            BindingServiceProvider.ResourceResolver.AddType(typeof(UITableViewScrollPosition));

            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UITableView.UseAnimations]    = BindingServiceProvider.TemplateMemberPriority + 1;
            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UITableView.AddAnimation]     = BindingServiceProvider.TemplateMemberPriority + 1;
            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UITableView.RemoveAnimation]  = BindingServiceProvider.TemplateMemberPriority + 1;
            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UITableView.ReplaceAnimation] = BindingServiceProvider.TemplateMemberPriority + 1;
            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UITableView.ScrollPosition]   = BindingServiceProvider.TemplateMemberPriority + 1;

            BindingBuilderExtensions.RegisterDefaultBindingMember(AttachedMembers.UIView.ItemsSource.Override <UITableView>());
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.AddAnimation));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.RemoveAnimation));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.ReplaceAnimation));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.ScrollPosition));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.UseAnimations));
            MemberProvider.Register(AttachedBindingMember.CreateEvent(AttachedMembers.UITableView.SelectedItemChangedEvent));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIView.ItemsSource.Override <UITableView>(), TableViewItemsSourceChanged));
            MemberProvider.Register(AttachedBindingMember.CreateMember(AttachedMembers.UITableView.SelectedItem,
                                                                       GetTableViewSelectedItem, SetTableViewSelectedItem,
                                                                       (info, view, arg3) => (IDisposable)view.SetBindingMemberValue(AttachedMembers.UITableView.SelectedItemChangedEvent, arg3)));
            var itemTemplateMember = AttachedBindingMember.CreateAutoProperty(AttachedMembers.UITableView.ItemTemplateSelector, (view, args) => args.NewValue?.Initialize(view));

            MemberProvider.Register(itemTemplateMember);
            MemberProvider.Register(typeof(UITableView), AttachedMemberConstants.ItemTemplate, itemTemplateMember, true);
        }
        public static void RegisterObjectMembers()
        {
            var itemsSourceMember         = AttachedBindingMember.CreateAutoProperty <object, IEnumerable>(AttachedMemberConstants.ItemsSource, ObjectItemsSourceChanged);
            var defaultMemberRegistration = new DefaultAttachedMemberRegistration <IEnumerable>(itemsSourceMember);

            MemberProvider.Register(defaultMemberRegistration.ToAttachedBindingMember <object>());
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty <object, ICollectionViewManager>(AttachedMembers.UIView.CollectionViewManager.Path));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty <object, IContentViewManager>(AttachedMembers.UIView.ContentViewManager.Path));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(ItemsSourceGeneratorBase.MemberDescriptor,
                                                                             (o, args) =>
            {
                IEnumerable itemsSource = null;
                if (args.OldValue != null)
                {
                    itemsSource = args.OldValue.ItemsSource;
                    args.OldValue.SetItemsSource(null);
                }
                args.NewValue?.SetItemsSource(itemsSource);
            }));

            var itemTemplateMember = AttachedBindingMember.CreateAutoProperty <object, IDataTemplateSelector>(AttachedMemberConstants.ItemTemplateSelector);

            MemberProvider.Register(itemTemplateMember);
            MemberProvider.Register(typeof(object), AttachedMemberConstants.ItemTemplate, itemTemplateMember, true);
        }
        private static void RegisterViewMembers(IBindingMemberProvider memberProvider)
        {
            //View
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, int>(AttachedMemberNames.MenuTemplate));

#if !API8
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, int>(AttachedMemberNames.PopupMenuTemplate));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, string>(AttachedMemberNames.PopupMenuEvent, PopupMenuEventChanged));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, string>(AttachedMemberNames.PlacementTargetPath));
#endif
            memberProvider.Register(AttachedBindingMember.CreateMember <View, object>(AttachedMemberConstants.Parent, GetViewParentValue, null, ObserveViewParent));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, object>(AttachedMemberConstants.FindByNameMethod, ViewFindByNameMember));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>(AttachedMemberConstants.Focused,
                                                                                    (info, view) => view.IsFocused, null, "FocusChange"));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>(AttachedMemberConstants.Enabled,
                                                                                    (info, view) => view.Enabled, (info, view, value) => view.Enabled = value));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, ViewStates>("Visibility",
                                                                                          (info, view) => view.Visibility, (info, view, value) => view.Visibility = value,
                                                                                          ObserveViewVisibility));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>("Visible",
                                                                                    (info, view) => view.Visibility == ViewStates.Visible,
                                                                                    (info, view, value) => view.Visibility = value ? ViewStates.Visible : ViewStates.Gone,
                                                                                    ObserveViewVisibility));
            memberProvider.Register(AttachedBindingMember.CreateMember <View, bool>("Hidden",
                                                                                    (info, view) => view.Visibility != ViewStates.Visible,
                                                                                    (info, view, value) => view.Visibility = value ? ViewStates.Gone : ViewStates.Visible,
                                                                                    ObserveViewVisibility));
        }
Пример #8
0
 protected override bool LoadInternal()
 {
     BindingServiceProvider.MemberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, bool>("IsBusy", IsBusyChanged));
     BindingServiceProvider.MemberProvider.Register(AttachedBindingMember.CreateAutoProperty <View, string>("BusyMessage", BusyMessageChanged));
     IocContainer.BindToConstant <IRepository>(new FileRepository());
     return(true);
 }
        public void AutoPropertyGenericObserveTest()
        {
            bool isInvoked    = false;
            var  listenerMock = new EventListenerMock
            {
                Handle = (o, o1) => isInvoked = true
            };
            var          source   = new BindingSourceModel();
            const string path     = "path";
            var          property = AttachedBindingMember.CreateAutoProperty <BindingSourceModel, string>(path);

            IDisposable subscriber = property.TryObserve(source, listenerMock);

            property.SetValue(source, new object[] { path });
            isInvoked.ShouldBeTrue();
            subscriber.ShouldNotBeNull();

            isInvoked = false;
            property.SetValue(source, new object[] { path });
            isInvoked.ShouldBeFalse();

            isInvoked = false;
            property.SetValue(source, new object[] { null });
            isInvoked.ShouldBeTrue();

            subscriber.Dispose();
            isInvoked = false;
            property.SetValue(source, new object[] { path });
            isInvoked.ShouldBeFalse();
        }
        public void ProviderShouldRegisterUnregisterAndResolveAttachedMemberMulti()
        {
            const int    count      = 10;
            const string memberPath = "Test";
            var          targetType = typeof(object);
            var          members    = new List <IBindingMemberInfo>();
            var          provider   = CreateMemberProvider();

            for (int i = 0; i < count; i++)
            {
                var memberInfo = AttachedBindingMember.CreateAutoProperty(memberPath + i, typeof(object));
                provider.GetBindingMember(targetType, memberPath + i, false, false).ShouldBeNull();
                members.Add(memberInfo);
                provider.Register(targetType, memberInfo, false);
            }

            for (int i = 0; i < count; i++)
            {
                provider.GetBindingMember(targetType, memberPath + i, false, false)
                .ShouldEqual(members[i]);
            }
            provider.Unregister(targetType);
            for (int i = 0; i < count; i++)
            {
                provider.GetBindingMember(targetType, memberPath + i, false, false)
                .ShouldBeNull();
            }
        }
Пример #11
0
        public static void RegisterControlMembers()
        {
            var sizeChanged = MemberProvider.GetBindingMember(typeof(Control), nameof(Control.SizeChanged), true, false);

            if (sizeChanged != null)
            {
                MemberProvider.Register(typeof(Control), "WidthChanged", sizeChanged, true);
                MemberProvider.Register(typeof(Control), "HeightChanged", sizeChanged, true);
            }
            MemberProvider.Register(AttachedBindingMember
                                    .CreateMember <Control, object>(AttachedMemberConstants.FindByNameMethod, FindByNameControlMember));
            MemberProvider.Register(AttachedBindingMember
                                    .CreateMember <Control, bool>(AttachedMemberConstants.Focused, (info, control) => control.Focused,
                                                                  (info, control, arg3) =>
            {
                if (arg3)
                {
                    control.Focus();
                }
            }, nameof(Control.LostFocus)));

            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.Control.Content, ContentChanged));
            var contenMember = AttachedBindingMember.CreateAutoProperty(AttachedMembers.Control.ContentTemplateSelector, ContentTemplateChanged);

            MemberProvider.Register(contenMember);
            MemberProvider.Register(typeof(Control), AttachedMemberConstants.ContentTemplate, contenMember, true);
        }
Пример #12
0
        public void ResolverShouldRegisterAndResolveDynamicObjectTarget()
        {
            string name = BindingServiceProvider.ResourceResolver.RootElementResourceName;
            var    visualTreeManagerMock = new VisualTreeManagerMock();

            BindingServiceProvider.VisualTreeManager = visualTreeManagerMock;
            var rootMember = AttachedBindingMember.CreateAutoProperty <object, object>("root");

            visualTreeManagerMock.GetRootMember = type => rootMember;
            var target = new object();

            rootMember.SetValue(target, target);

            var dataContext = new DataContext
            {
                { BindingBuilderConstants.Target, target }
            };

            var resolver = CreateBindingResourceResolver();

            bool isInvoked = false;
            var  value     = resolver.ResolveObject(name, dataContext, false);

            value.Value.ShouldEqual(target);
            value.ValueChanged += (sender, args) => isInvoked = true;

            rootMember.SetValue(target, name);
            value.Value.ShouldEqual(name);
            isInvoked.ShouldBeTrue();
        }
Пример #13
0
        private static void RegisterMembers(IBindingMemberProvider memberProvider)
        {
#if !APPCOMPAT
            //View
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.ViewGroup.AddToBackStack));
#endif
        }
Пример #14
0
 static BindingExtensions()
 {
     EmptyListener        = new WeakEventListener();
     AttachedParentMember = AttachedBindingMember.CreateAutoProperty <object, object>("#" + AttachedMemberConstants.Parent);
     NullValue            = new object[] { null };
     MergePathDelegate    = MergePath;
 }
Пример #15
0
 public static void RegisterToolbarMembers()
 {
     //Toolbar
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.View.MenuTemplate.Override <Toolbar>(), ToolbarMenuTemplateChanged));
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersCompat.Toolbar.IsActionBar,
                                                                      ToolbarIsActionBarChanged));
 }
Пример #16
0
        static PlatformDataBindingModule()
        {
            AddViewValue    = new object();
            RemoveViewValue = new object[] { null };
            //Menu
            MenuItemsSourceMember   = AttachedBindingMember.CreateAutoProperty <IMenu, IEnumerable>(AttachedMemberConstants.ItemsSource, MenuItemsSourceChanged);
            IsCheckedMenuItemMember = AttachedBindingMember.CreateNotifiableMember <IMenuItem, bool>("IsChecked",
                                                                                                     (info, item) => item.IsChecked, (info, item, value) =>
            {
                if (value == item.IsChecked)
                {
                    return(false);
                }
                item.SetChecked(value);
                return(true);
            });
#if !API8
            MenuItemActionViewMember = AttachedBindingMember
                                       .CreateNotifiableMember <IMenuItem, object>("ActionView", (info, item) => item.GetActionView(), MenuItemUpdateActionView);
            MenuItemActionViewSelectorMember = AttachedBindingMember
                                               .CreateAutoProperty <IMenuItem, IDataTemplateSelector>("ActionViewTemplateSelector", (o, args) => RefreshValue(o, MenuItemActionViewMember));

            MenuItemActionProviderMember = AttachedBindingMember
                                           .CreateNotifiableMember <IMenuItem, object>("ActionProvider", (info, item) => item.GetActionProvider(), MenuItemUpdateActionProvider);
            MenuItemActionProviderSelectorMember = AttachedBindingMember
                                                   .CreateAutoProperty <IMenuItem, IDataTemplateSelector>("ActionProviderTemplateSelector", (o, args) => RefreshValue(o, MenuItemActionProviderMember));

            AddToBackStackMember = AttachedBindingMember.CreateAutoProperty <ViewGroup, bool>("AddToBackStack");
#endif
            //ViewGroup
            ContentMember = AttachedBindingMember
                            .CreateAutoProperty <ViewGroup, object>(AttachedMemberConstants.Content, ContentMemberChanged, ContentMemberAttached);
            ContentTemplateIdMember = AttachedBindingMember
                                      .CreateAutoProperty <ViewGroup, int?>(AttachedMemberConstants.ContentTemplate, ContentTemplateIdChanged);
            ContentTemplateSelectorMember = AttachedBindingMember
                                            .CreateAutoProperty <ViewGroup, IDataTemplateSelector>(AttachedMemberConstants.ContentTemplateSelector, ContentTemplateSelectorChanged);

            //AdapterView
            AdapterViewSelectedPositionMember =
                AttachedBindingMember.CreateAutoProperty <AdapterView, int>("SelectedItemPosition",
                                                                            AdapterViewSelectedItemPositionChanged, AdapterViewSelectedMemberAttached, (view, info) => view.SelectedItemPosition);
            AdapterViewSelectedItemMember = AttachedBindingMember.CreateAutoProperty <AdapterView, object>(
                AttachedMemberConstants.SelectedItem, AdapterViewSelectedItemChanged);
            ScrollToSelectedItemMember = AttachedBindingMember.CreateAutoProperty <AdapterView, bool>("ScrollToSelectedItem");

            //TabHost
            TabHostSelectedItemMember = AttachedBindingMember.CreateAutoProperty <TabHost, object>(AttachedMemberConstants.SelectedItem, TabHostSelectedItemChanged);

#if !API8
            //Action bar
            ActionBarItemsSourceMember  = AttachedBindingMember.CreateAutoProperty <ActionBar, IEnumerable>(AttachedMemberConstants.ItemsSource, (bar, args) => ActionBarUpdateItemsSource(bar));
            ActionBarSelectedItemMember = AttachedBindingMember.CreateAutoProperty <ActionBar, object>(AttachedMemberConstants.SelectedItem, ActionBarSelectedItemChanged);
            //Context action bar
            ActionBarContextActionBarTemplateMember = AttachedBindingMember.CreateAutoProperty <ActionBar, int?>("ContextActionBarTemplate");
            ActionBarContextActionBarVisibleMember  = AttachedBindingMember.CreateAutoProperty <ActionBar, bool>("ContextActionBarVisible", ActionBarContextActionBarVisibleChanged);

            //ActioBar.Tab
            ActionBarTabContentMember = AttachedBindingMember.CreateAutoProperty <ActionBar.Tab, object>(AttachedMemberConstants.Content);
#endif
        }
Пример #17
0
        public bool Load(IModuleContext context)
        {
            //Registering attached property
            var memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <Image, string>("ImageUrl", OnImageUrlChanged));
            return(true);
        }
Пример #18
0
 public static void RegisterBottomNavigationViewMembers()
 {
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.View.MenuTemplate.Override <BottomNavigationView>(),
                                                                      BottomNavigationViewMenuTemplateChanged));
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersDesign.BottomNavigationView.SelectedItemId,
                                                                      (view, args) => { view.SelectedItemId = args.NewValue; }, (view, args) => { view.SetOnNavigationItemSelectedListener(new NavigationItemSelectedListener(view)); },
                                                                      (view, info) => view.SelectedItemId));
 }
        public static void RegisterPreferenceGroupMembers()
        {
            BindingBuilderExtensions.RegisterDefaultBindingMember(AttachedMembers.PreferenceGroup.ItemsSource);
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.PreferenceGroup.ItemsSource, PreferenceGroupItemsSourceChanged));
            var templateMember = AttachedBindingMember.CreateAutoProperty(AttachedMembers.PreferenceGroup.ItemTemplateSelector);

            MemberProvider.Register(templateMember);
            MemberProvider.Register(AttachedMemberConstants.ItemTemplate, templateMember);
        }
Пример #20
0
        public bool Load(IModuleContext context)
        {
            //force load assembly
            var type = typeof(MugenMvvmToolkit.Xamarin.Forms.Binding.AttachedMembers);
            //Registering attached property
            var memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <Image, string>("ImageUrl", OnImageUrlChanged));
            return(true);
        }
Пример #21
0
        public static void RegisterRecyclerViewMembers()
        {
            BindingServiceProvider.BindingMemberPriorities[AttachedMembersRecyclerView.RecyclerView.CreateViewHolderDelegate] = BindingServiceProvider.TemplateMemberPriority + 1;

            var provider = BindingServiceProvider.MemberProvider;

            provider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.ViewGroup.ItemsSource.Override <global::Android.Support.V7.Widget.RecyclerView>(),
                                                                       RecyclerViewItemsSourceChanged));
            provider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersRecyclerView.RecyclerView.CreateViewHolderDelegate));
        }
Пример #22
0
        public bool Load(IModuleContext context)
        {
            //Registering attached property
            var memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateMember <ListView, object>(AttachedMemberConstants.SelectedItem, GetListViewSelectedItem, SetListViewSelectedItem,
                                                                                          "ItemSelectionChanged"));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <PictureBox, string>("ImageUrl", OnImageUrlChanged));
            return(true);
        }
Пример #23
0
        protected override bool LoadInternal()
        {
            BindingServiceProvider.BindingMemberPriorities[AttachedMembersRecyclerView.RecyclerView.CreateViewHolderDelegate] = BindingServiceProvider.TemplateMemberPriority + 1;

            var provider = BindingServiceProvider.MemberProvider;

            provider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.ViewGroup.ItemsSource.Override <global::Android.Support.V7.Widget.RecyclerView>(), RecyclerViewItemsSourceChanged));
            provider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersRecyclerView.RecyclerView.CreateViewHolderDelegate));
            return(true);
        }
        static PlatformDataBindingModule()
        {
            //Object
            ItemsSourceMember           = AttachedBindingMember.CreateAutoProperty <object, IEnumerable>(AttachedMemberConstants.ItemsSource, ObjectItemsSourceChanged);
            CollectionViewManagerMember = AttachedBindingMember.CreateAutoProperty <object, ICollectionViewManager>("CollectionViewManager");
            ContentViewManagerMember    = AttachedBindingMember.CreateAutoProperty <object, IContentViewManager>("ContentViewManager");

            //Control
            ContentMember         = AttachedBindingMember.CreateAutoProperty <Control, object>(AttachedMemberConstants.Content, ContentChanged);
            ContentTemplateMember = AttachedBindingMember.CreateAutoProperty <Control, IDataTemplateSelector>(AttachedMemberConstants.ContentTemplate, ContentTemplateChanged);
        }
Пример #25
0
        protected override bool LoadInternal()
        {
            IocContainer.BindToConstant <IRepository>(new FileRepository());

#if !XAMARINFORMS
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.UIView.IsBusy, IsBusyChanged));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.UIView.BusyMessage, BusyMessageChanged));
#endif
            return(true);
        }
        public static void RegisterViewControllerMembers()
        {
            BindingServiceProvider.BindingMemberPriorities["ToolbarItemTemplate"] = BindingServiceProvider.TemplateMemberPriority;
            BindingServiceProvider.BindingMemberPriorities[AttachedMembers.UIViewController.ToolbarItemTemplateSelector] = BindingServiceProvider.TemplateMemberPriority;
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIViewController.ToastTemplateSelector));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIViewController.ToolbarItemsSource, ToolbarItemsSourceChanged));
            var templateMember = AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIViewController.ToolbarItemTemplateSelector);

            MemberProvider.Register(templateMember);
            MemberProvider.Register(typeof(UIViewController), "ToolbarItemTemplate", templateMember, true);
        }
        protected override bool LoadInternal()
        {
            if (Mode != LoadMode.Design)
            {
                IocContainer.BindToConstant <IRepository>(new FileRepository());
            }
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.Control.IsBusy, IsBusyChanged));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.Control.BusyMessage, BusyMessageChanged));
            return(true);
        }
Пример #28
0
        /// <summary>
        ///     Loads the current module.
        /// </summary>
        protected override bool LoadInternal()
        {
            //Registering attached property
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateAutoProperty <UILabel, string>("TextExt",
                                                                                               TextExtMemberChanged, TextExtMemberAttached, TextExtGetDefaultValue));

            memberProvider.Register(AttachedBindingMember.CreateMember <UILabel, string>("FormattedText",
                                                                                         GetFormattedTextValue, SetFormattedTextValue, ObserveFormattedTextValue));
            return(true);
        }
        public static void RegisterViewMembers()
        {
            MemberProvider.Register(AttachedBindingMember.CreateMember <UIView, object>(AttachedMemberConstants.Parent,
                                                                                        (info, view) => ParentObserver.GetOrAdd(view).Parent, (info, view, arg3) => ParentObserver.GetOrAdd(view).Parent = arg3,
                                                                                        (info, view, arg3) => ParentObserver.GetOrAdd(view).AddWithUnsubscriber(arg3)));
            MemberProvider.Register(AttachedBindingMember.CreateMember <UIView, object>(AttachedMemberConstants.FindByNameMethod, FindViewByName));
            MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIView.Content, ContentChanged));
            var member = AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIView.ContentTemplateSelector, ContentTemplateChanged);

            MemberProvider.Register(member);
            MemberProvider.Register(typeof(UIView), AttachedMemberConstants.ContentTemplate, member, true);
            MemberProvider.Register(AttachedBindingMember.CreateMember(AttachedMembers.UIView.Visible, (info, view) => !view.Hidden, (info, view, arg3) => view.Hidden = !arg3));
        }
 public static void RegisterPickerViewMembers()
 {
     BindingBuilderExtensions.RegisterDefaultBindingMember(AttachedMembers.UIView.ItemsSource.Override <UIPickerView>());
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIView.ItemsSource.Override <UIPickerView>(), PickerViewItemsSourceChanged));
     MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.UIPickerView.DisplayMemberPath, PickerViewDisplayMemberPathChangedChanged));
     MemberProvider.Register(AttachedBindingMember.CreateMember(AttachedMembers.UIPickerView.SelectedItem,
                                                                (info, view) => GetOrAddPickerViewModel(view).SelectedItem,
                                                                (info, view, arg3) => GetOrAddPickerViewModel(view).SelectedItem = arg3, (info, view, arg3) =>
     {
         var viewModel = GetOrAddPickerViewModel(view);
         return(BindingServiceProvider.WeakEventManager.TrySubscribe(viewModel, nameof(MvvmPickerViewModel.SelectedItemChanged), arg3));
     }));
 }