WPF, Prism v2, Region in a modal dialog, add region in code behind

前端 未结 3 1100
清酒与你
清酒与你 2020-12-09 18:53

I have a composite WPF application. In one of my modules I want to make a wizard and have the steps show up in a region so I can switch between the steps easier. Originally

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 19:58

    I found something thats almost working. I'm sure if i could bind the region's active view to the contentContol's content property then it would work, but I haven't managed that yet.

    IRegionManager MyRegionManager = container.Resolve();
    SingleActiveRegion newRegion = new SingleActiveRegion();
    MyRegionManager.Regions.Add("WizardSteps", newRegion);
    
    //Binding
    Binding myBinding = new Binding("ActiveViews");
    myBinding.Source = newRegion;
    view.stepControl.SetBinding(ContentControl.ContentProperty, myBinding);
    

提交回复
热议问题