문제

This has been giving me pain for some time.

I know Prism injects views into regions, however is there a way of doing a similar sort of thing with Cinch, on a view first basis? For example I have a container (effectively a region) which can contain any view at runtime - I don't particularly want to set the view explicitly in XAML as this will load it up, and it's a bit messy. Is there a container that I can use for this? And how would I go about it? (doesn't have to be Cinch specific..)

thanks.

도움이 되었습니까?

해결책

To answer my own question I've found that Prism v4 has provided a useful solution - a RegionExtension called RequestNavigate.

I have used RequestNavigate for opening a new window (check out StockTrader RI) however this seems extremely cumbersome, if following the proper MVVM methodology. Instead I've decided to use the ChildWindow class in the WPF Extended Toolkit, where you can purely bind to the 'WindowState' (open/closed) property, and specify everything else in XAML.

I've also used RequestNavigate for injecting views into Regions - I'm now using MEF (at the time I was using Unity). I find the approach a lot more flexible, if slightly 'magic' regarding debugging.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top