private void PrepareTextView()
        {
            var textview = FindViewById <TextView>(Resource.Id.firstview_textview);

            BindingSet.Bind(textview).To(vm => vm.Hello);
            BindingSet.Apply();
        }
        private void PrepareEditText()
        {
            var edittext = FindViewById <EditText>(Resource.Id.firstview_edittext);

            BindingSet.Bind(edittext).To(vm => vm.Hello).OneWayToSource();
            BindingSet.Apply();
        }
Exemple #3
0
        public object SelectTemplate(object item, object container)
        {
            TTemplate template = SelectTemplate((TSource)item, container);

            if (template != null && CanInitialize(template, container))
            {
                if (_bindingSet == null)
                {
                    Interlocked.CompareExchange(ref _bindingSet, new BindingSet <TTemplate, TSource>(template), null);
                }
                bool lockTaken = false;
                try
                {
                    Monitor.Enter(_bindingSet, ref lockTaken);
                    _bindingSet.Target = template;
                    Initialize(template, _bindingSet);
                    _bindingSet.Apply();
                }
                finally
                {
                    _bindingSet.Target = null;
                    if (lockTaken)
                    {
                        Monitor.Exit(_bindingSet);
                    }
                }
            }
            return(template);
        }
        private void PrepareTextView()
        {
            var view = FindViewById <TextView>(Resource.Id.secondview_textview);

            BindingSet.Bind(view).To(vm => vm.SecondData);
            BindingSet.Apply();
        }
        private void PrepareLoadingButton()
        {
            var hero = FindViewById <Button>(Resource.Id.fifthview_loading_button);

            hero.Text = DreamsResources.FifthView_Loading_Button_label;
            BindingSet.Bind(hero).To(vm => vm.LoadingCommand);
            BindingSet.Apply();
        }
        private void PrepareShowSecondButton()
        {
            var hero = FindViewById <Button>(Resource.Id.firstview_show_second_button);

            hero.Text = DreamsResources.FirstView_ShowSecond_Button_Label;
            BindingSet.Bind(hero).To(vm => vm.ShowSecondCommand);
            BindingSet.Apply();
        }
        private void PrepareInfoButton()
        {
            var hero = FindViewById <Button>(Resource.Id.fifthview_info_button);

            hero.Text = DreamsResources.FifthView_Info_Button_Label;
            BindingSet.Bind(hero).To(vm => vm.InfoCommand);
            BindingSet.Apply();
        }
Exemple #8
0
        private void PrepareContentA()
        {
            var a      = FindViewById <View>(Resource.Id.fourthview_content_a);
            var button = a.FindViewById <Button>(Resource.Id.content_fourthview_button);

            BindingSet.Bind(button).To(vm => vm.ShowFifthCommand);
            BindingSet.Apply();
        }
        private void PrepareButton()
        {
            var view = FindViewById <Button>(Resource.Id.secondview_show_third_button);

            view.Text = DreamsResources.SecondView_ShowThird_Button_Label;
            BindingSet.Bind(view).To(vm => vm.ShowThirdCommand);
            BindingSet.Apply();
        }
Exemple #10
0
        private void PrepareRecyclerView()
        {
            var recyclerView = FindViewById <MvxRecyclerView>(Resource.Id.my_recycler_view);

            recyclerView.ItemTemplateId = Resource.Layout.listitem_thirdview_recyclerview;
            BindingSet.Bind(recyclerView).For(x => x.ItemsSource).To(vm => vm.Data);
            BindingSet.Bind(recyclerView).For(x => x.ItemClick).To(vm => vm.ItemSelectedCommand);
            BindingSet.Apply();
        }
        void ICollectionCellTemplateSelector.InitializeTemplate(UICollectionView container, UICollectionViewCell cell)
        {
            if (!SupportInitialize)
            {
                return;
            }
            var bindingSet = new BindingSet <TTemplate, TSource>((TTemplate)cell);

            InitializeTemplate(container, (TTemplate)cell, bindingSet);
            bindingSet.Apply();
        }
        public override void Bind(TItemsContext itemsContext)
        {
            base.Bind(itemsContext);

            if (_itemsContextBindingSet == null)
            {
                _itemsContextBindingSet = new BindingSet <TItemsContext>(itemsContext);
                Bind(_itemsContextBindingSet);
                _itemsContextBindingSet.Apply();
            }
        }
        public override void OnStart()
        {
            base.OnStart();

            if (_bindingSet == null)
            {
                _bindingSet = new BindingSet <TViewModel>(ViewModel);
                View.Bind(_bindingSet);
                _bindingSet.Apply();
            }
        }
        public override void ViewWillAppear()
        {
            base.ViewWillAppear();

            if (_bindingSet == null)
            {
                _bindingSet = new BindingSet <TViewModel>(ViewModel);
                View.Bind(_bindingSet);
                _bindingSet.Apply();
            }
        }
Exemple #15
0
        /// <summary>
        ///     Override this method to return an app specific template.
        /// </summary>
        /// <param name="item">The data content</param>
        /// <param name="container">The element to which the template will be applied</param>
        /// <returns>
        ///     An app-specific template to apply, or null.
        /// </returns>
        public object SelectTemplate(object item, object container)
        {
            TTemplate template = SelectTemplate((TSource)item, container);

            if (SupportInitialize && template != null)
            {
                var bindingSet = new BindingSet <TTemplate, TSource>(template);
                Initialize(template, bindingSet);
                bindingSet.Apply();
            }
            return(template);
        }
        UITableViewCell ITableCellTemplateSelector.SelectTemplate(UITableView container, NSString identifier)
        {
            TTemplate template = SelectTemplate(container, identifier);

            if (SupportInitialize && template != null)
            {
                var bindingSet = new BindingSet <TTemplate, TSource>(template);
                Initialize(template, bindingSet);
                bindingSet.Apply();
            }
            return(template);
        }
        public override void OnStart()
        {
            base.OnStart();

            if (View.BindingSet == null)
            {
                var bindingSet = new BindingSet <TViewModel>(View.ViewModel);

                View.Bind(bindingSet);
                View.SetBindingSet(bindingSet);
                bindingSet.Apply();
            }
        }
        public object SelectTemplate(object item, object container)
        {
            var page = new TabPage();
            var set  = new BindingSet <TabPage, IViewModel>(page);

            set.BindFromExpression("Content ;");
            set.BindFromExpression("Text DisplayName");
            set.BindFromExpression("IsBusy IsBusy");
            set.BindFromExpression("BusyMessage BusyMessage");
            set.Apply();

            return(page);
        }
        public override void Bind(TItem item)
        {
            base.Bind(item);

            if (_itemBindingSet == null)
            {
                _itemBindingSet = new BindingSet <TItem>(item);
                Bind(_itemBindingSet);
                _itemBindingSet.Apply();
            }
            else
            {
                _itemBindingSet.SetSourceItem(item);
            }
        }
Exemple #20
0
        private static TabPage CreateDefaultTabPage(object item)
        {
            var viewModel = item as IViewModel;

            if (viewModel == null)
            {
                return(new TabPage(item == null ? "null" : item.ToString()));
            }
            var page = new TabPage();
            var set  = new BindingSet <TabPage, IViewModel>(page);

            set.BindFromExpression("Content ;");
            if (viewModel is IHasDisplayName)
            {
                set.BindFromExpression("Text DisplayName;");
            }
            set.Apply();
            page.SetDataContext(item);
            return(page);
        }
Exemple #21
0
 void ITableCellTemplateSelector.InitializeTemplate(UITableView container, UITableViewCell cell)
 {
     if (!SupportInitialize)
     {
         return;
     }
     if (_bindingSet == null)
     {
         _bindingSet = new BindingSet <TTemplate, TSource>(null);
     }
     try
     {
         _bindingSet.Target = (TTemplate)cell;
         Initialize(_bindingSet.Target, _bindingSet);
         _bindingSet.Apply();
     }
     finally
     {
         _bindingSet.Target = null;
     }
 }
Exemple #22
0
        object IDataTemplateSelector.SelectTemplate(object item, object container)
        {
            TTemplate template = SelectTemplate((TSource)item, container);

            if (template != null && CanInitialize(template, container))
            {
                if (_bindingSet == null)
                {
                    _bindingSet = new BindingSet <TTemplate, TSource>(null);
                }
                try
                {
                    _bindingSet.Target = template;
                    Initialize(template, _bindingSet);
                    _bindingSet.Apply();
                }
                finally
                {
                    _bindingSet.Target = null;
                }
            }
            return(template);
        }
 private static TabPage CreateDefaultTabPage(object item)
 {
     var viewModel = item as IViewModel;
     if (viewModel == null)
         return new TabPage(item == null ? "null" : item.ToString());
     var page = new TabPage();
     var set = new BindingSet<TabPage, IViewModel>(page);
     set.BindFromExpression("Content ;");
     if (viewModel is IHasDisplayName)
         set.BindFromExpression("Text DisplayName;");
     set.Apply();
     page.SetDataContext(item);
     return page;
 }
 public void Apply()
 {
     _bindingSet.Apply();
 }