有没有办法从PRISM C#WPF中的区域获取hostcontrol/parentcontrol。我试图写一个自定义区域的行为,修改hostcontrol,如果没有在该地区的意见。从PRISM中的区域获取HostControl
RegionBehavior类中有一个HostControl属性,但它是alwasy null。我如何设置它?或如何获得主机控制。 感谢您的咨询!
[Export(typeof(CollapseRegionBehavior))]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class CollapseRegionBehavior : RegionBehavior, IHostAwareRegionBehavior
{
public DependencyObject HostControl { get; set; }
protected override void OnAttach()
{
if (this.Region.ActiveViews.Count() == 0)
{
}
}
}
是的,我也注意到了。看起来,IHostAwareRegionBehavior只能在bootstrapper中工作后才能找到HostControl。谢谢! – Tan