Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Expander > Unable to find PRISM regions defined inside RadExpander content

Not answered Unable to find PRISM regions defined inside RadExpander content

Feed from this thread
  • Syam avatar

    Posted on Sep 22, 2011 (permalink)

    Hi,

    I am placing a region "JobTabRegion"(using a ContentControlin the DataTemplate of  a RadTabControl in my Shell. This "JobTabRegion" is bind to view named "MainJobView" which in turn has a RadTabControl and regions are marked inside the RadTabItem.Content (using a ContentControlof each RadTabItem. One such region would be "JobRequestRegion" which is bind to a view named "JobRequestView". This "JobRequestView" has a RadExpander control and I am having a region marked (using a ContentControlinside the RadExpander.Content called "ExpanderRegion" . I am using two buttons to switch the contents of the RadExpander. To do so, in the ViewModel of  "JobRequestView", when i try to access the "ExpanderRegion" from the Region Manager instance, i get an error saying "The region manager does not contain the ExpanderRegion region." 

    I have read in an article that the regions marked inside a DataTemplate will not be available in the RegionCollection of the Region Manager. But i didn't get any proper solution. I am using PRISM v 4 and Silverlight 4.

    Any help would be appreciated. Thanks in advance.

    Syam


    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Sep 27, 2011 (permalink)

    Hello Syam,

    In order to implement your scenario you'll need to manually set the region manager so that you can access the ExpanderRegion:
    RegionManager.SetRegionManager(contentControl,(this.DataContext as JobRequestViewModel).MyRegionManager);

    I attached a sample project to get you started. Give it a try and let me know if it helps.

    Best wishes,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Syam avatar

    Posted on Sep 28, 2011 (permalink)

    Hi Tina,

    Thanks for you reply. I will try this out and let you know.

    Reply

  • Syam avatar

    Posted on Sep 29, 2011 (permalink)

    Hi Tina,

    Thanks for your solution. It worked and I was able to get the "ExpanderRegion" in the RegionManager's region collection. In your solution, you are binding two different views to the "ExpanderRegion" using the following condition:

    if (param.ToString().Contains("1"))
    this.MyRegionManager.Regions["ExpanderRegion"].Activate(this.MyRegionManager.Regions["ExpanderRegion"].Views.FirstOrDefault());
    else
    this.MyRegionManager.Regions["ExpanderRegion"].Activate(this.MyRegionManager.Regions["ExpanderRegion"].Views.LastOrDefault());

    In my case i need to bind more than 2 Views into this region and also it might come from different Prism Modules. How would i do that ? 

    Thanks in advance
    Syam 

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Sep 30, 2011 (permalink)

    Hi Syam,

    You can use the same approach even if the vies in the ExpanderRegion are added from different modules. I modified slightly the sample project so please have a look at it and let me know if it helps. Also, if I'm missing something from your scenario, let me know.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Expander > Unable to find PRISM regions defined inside RadExpander content
Related resources for "Unable to find PRISM regions defined inside RadExpander content"

Silverlight Expander Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]