Prism Region in RadTabItem ContentTemplate

2 posts, 0 answers
  1. David
    David avatar
    18 posts
    Member since:
    Apr 2016

    Posted 26 Sep 2016 Link to this post

    Hi. I have a RadTabControl, wich ContentTemplate is a static resource with a DataTemplate like this:


            <DataTemplate x:Key="TabItemContentTemplate" >
                <ContentControl prism:RegionManager.RegionName="{Binding RegionName}"/>

    My item view model has a Header property and a RegionName property. All I want is to know the exactly moment all the templates are applied in the RadTabControl, so I can call the RegionManager to create a view inside.

    I've tried RadTabControl.Loaded and may others, also have tried to locate ContentPresenter named ContentElement and attach to the Loaded event, but even there the content control is not yet created.


    Any ideas? Thanks in advance.



  2. Kiril Vandov
    Kiril Vandov avatar
    324 posts

    Posted 29 Sep 2016 Link to this post

    Hello David,

    The Template of the RadTabControl is applied just right after the OnApplyTemplate method is called, for WPF the Loaded event is fired after that initialization and can access all of the TabControlTemplate parts from in the event. However that does not guarantee that the Content of the SelectedtabItem will be inserted. That is because the RadTabControl selects its first item(if the IsDefaultItemSelected property is set, its default value is true) and that logic is executed inside a Dispatcher in the LoadedEvent. If you want to intersect the content insertion placing the logic inside a Dispatcher in the loaded event of the RadTabControl will do the trick and the content will be loaded.
    I am not sure about your implementation for Prism for the RadTabControl and the need to inject such views manually when you can have the Prism do the work for you. We have an SDK sample for a PRISM implementation with our RadTabControl and a CustomRegionAddapter for it in our online repository.

    I hope this information helps.

    Kind regards,
    Kiril Vandov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top