protected override void OnStartup(StartupEventArgs e)
        {
            ViewModel = CreateApplicationViewModel();
            Bootstrapper.Run(CreateModules().ToArray());
            FrameBinder.Bind(this, ViewModel);

            base.OnStartup(e);
        }
Exemple #2
0
        private TabItem CreateTabItem(ViewModel model)
        {
            var item = new TabItem();

            FrameBinder.Bind(item, model);

            var view = (IBindableView)Service <IViewFactory> .Get().CreateView(model.GetPrefix(), model.GetViewStyle());

            view.ViewModel = model;
            item.Content   = view;

            return(item);
        }
        private static void OnBind(DependencyObject target, DependencyPropertyChangedEventArgs args)
        {
            var binding = FrameBinder.GetBindedFrame(target);

            if (binding == args.NewValue)
            {
                return;
            }

            if (binding != null)
            {
                FrameBinder.Unbind(target);
            }

            if (args.NewValue != null)
            {
                FrameBinder.Bind(target, args.NewValue);
            }
        }
        public static void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            var binding = FrameBinder.GetBindedFrame(sender);

            if (binding == args.NewValue)
            {
                return;
            }

            if (binding != null)
            {
                FrameBinder.Unbind(sender);
            }

            if (args.NewValue != null)
            {
                FrameBinder.Bind(sender, args.NewValue);
            }
        }