Unity - WPF MVVM Ligth - 拦截器

时间:2015-05-21 14:26:28

标签: c# wpf xaml mvvm unity-container

我在Wpf MVVM Light interceptor上使用Usercontrol时遇到了一些问题。

当我尝试在WPF interceptor上使用userControl时,我无法将其用作window.Content。 我的应用程序显示userControl的动态类型,而不是显示xaml部分。

没有interceptorhttp://img11.hostingpics.net/pics/984030821.jpg

interceptorhttp://img11.hostingpics.net/pics/526552682.jpg

示例:

var container = new Container();
var view = container.Resolve<IAuthView>("auth");

var window = new Window();
window.Content = view;

window.ShowDialog();

容器:

// Working well.
this.RegisterType<IAuthView, AuthView>("auth", new InjectionConstructor(this.Resolve<IAuthViewModel>()));


// Not working.
this.AddNewExtension<Interception>();

this.RegisterType<IAuthView, AuthView>("auth", new InjectionConstructor(this.Resolve<IAuthViewModel>()), new Interceptor<InterfaceInterceptor>(), new InterceptionBehavior<LoggingInterceptionBehavior>());

nota:我认为我的interceptor还可以,因为当我尝试使用非WPF UserControl时,它运行良好。 nota2:方法WillExecuteGetRequiredInterfaces被很好地调用。

我在网上再次搜索和搜索没有结果:(

有什么想法吗?

0 个答案:

没有答案