public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item != null)
            {
                Type viewModelType = item.GetType();
                return(CreateTemplate(viewModelType, viewFactory.GetViewType(viewModelType)));
            }

            return(base.SelectTemplate(item, container));
        }
Пример #2
0
        //ビューとの関連付け変更
        public void AttachView(IPoderosaView view)
        {
            _lastAttachedView = view;
            _currentView      = view;

            IViewFactory            vf           = WindowManagerPlugin.Instance.ViewFactoryManager.GetViewFactoryByDoc(_document.GetType());
            IContentReplaceableView rv           = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView));
            IPoderosaView           internalview = rv == null ? view : rv.AssureViewClass(vf.GetViewType()); //ContentReplaceableViewのときは中身を使用

            Debug.Assert(vf.GetViewType() == internalview.GetType());
            _sessionHost.Session.InternalAttachView(_document, internalview);
        }