This is a migrated thread and some comments may be shown as answers.

Prism Region.Activate Problem

11 Answers 375 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Betsy
Top achievements
Rank 1
Betsy asked on 27 Sep 2010, 06:11 PM
Using:  WPF 4.0, latest trial build of WPF controls

I'm using the RadTabControl with Prism and cannot get Region.Activate to work.  I successfully load multiple views into a RadTabControl that is defined as a Prism Region but when I want to activate one of the views already loaded as below the tab does not get selected as the new active tab.

 

Private Sub ShowChildScreen(ByVal param As ScreenActivateEventArgs)
If Not 
_screenregistry.ContainsKey(param.ScreenId) Then
    
Throw New 
InvalidOperationException(String.Format("ScreenId {0} not registered."param.ScreenId))
End If
Dim s As IScreen = 
_container.TryResolve(_screenregistry.Item(param.ScreenId))
s.ScreenSubject = 
param.ScreenSubject
Dim reg As IRegion = 
_regionManager.Regions(param.RegionName)
Dim v As Object
reg.GetView(s.ScreenKey)
If v Is Nothing Then
    reg.Add(s.View, 
s.ScreenKey)
Else
 reg.Activate(v)
End 
If
End Sub

 

 

 

 
My tab control XAML is as follows:

 

<telerik:RadTabControl cal:RegionManager.RegionName="MainWorkspaceRegion" 
Grid.Row="1" DropDownDisplayMode="Visible"
<telerik:RadTabControl.ItemContainerStyle>
<Style 
TargetType="{x:Type telerik:RadTabItem}"><Setter Property="Header" 
Value="{Binding DataContext}" /><Setter Property="HeaderTemplate"
<Setter.Value><DataTemplate><Grid
<Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/> 
<ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions
<TextBlock Grid.Column="0" Text="{Binding DisplayName}"/> 
<Button Command="{Binding CloseCommand}" Grid.Column="1" Content="X" 
Cursor="Hand" Focusable="False" FontFamily="Courier" 
FontSize="9" FontWeight="Bold" Margin="4,1,0,0" Padding="0" 
VerticalContentAlignment="Bottom" Width="16" Height="16" /> 
</Grid></DataTemplate> </Setter.Value
</Setter><Setter Property="Height" Value="25" /> 
<Setter Property="IsSelected" Value="True" />
</Style></telerik:RadTabControl.ItemContainerStyle
</telerik:RadTabControl>

 

 

 

 

 

11 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 30 Sep 2010, 11:42 AM
Hi Heather,

Let me double-check whether I fully understand your question. You expect, whenever you activate a view, the associated TabItem to be selected automatically, right? If this is the case, then you have to manually select the right tab whenever a view is activated. For example, let's say you activate a view called "View #1". You have to set the SelectedIndex of the TabControl to 1 in order to select the TabItem.
Let me know if this is what you have in mind. If not, could you please elaborate a little bit more on your scenario. It would also be great if you can send us a small project demonstrating the issue. This way we would be better able to assist you.

Greetings,
Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Betsy
Top achievements
Rank 1
answered on 30 Sep 2010, 01:16 PM
Yes that is correct.  I expect that if my radtabcontrol is defined as a region that issuing a region.Activate(view) call in code will select the corresponding tab as if someone clicked on it with the mouse.  The WPF TabControl does this correctly but the RadTabControl does not.  I could not attach a project to this item so I created support ticket  #353107 with a project that shows the problem.
0
Accepted
Kiril Stanoev
Telerik team
answered on 05 Oct 2010, 02:45 PM
Hi Heather,

I've posted a workaround to your support ticket. I'll also attach the workaround project here for the one who might be interested.

All the best,
Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joe
Top achievements
Rank 1
answered on 31 May 2011, 04:04 PM

Heather,

I am interested in this "workaround".  I am also surprised you used vb for the sample.
I have not worked anywhere that uses vb since C# .NET was released.  I do not even install it on my workstations.
Can you describe the example or do I need to install vb on my workstation?

The telerik RadDocking vs. Prism problems are killing me.
I have invested over fifty hours and cannot get ViewInjection (regionManager.RequestNavigate) to work.
Yeah, the new views appear when they are first injected, but the Prism ConfirmNavigationRequest methods are only ever called on the first Injected View.  The same methods on the other ones never fire, and no existing view ever becomes the top view when navigating back.  I thought about getting a reference from the view model to the view (I know!) to call the view to the top layer, but I cannot get a handle to the the telerik RadPane views from my view models because they are registered without a Name.

I expected telerik to give me productivity gains, but right now telerik has been a huge drain on my productivity.  In a few more hours I am going to tell my client I cannot get the product built using telerik.

Sincerely, Joe

0
Tina Stancheva
Telerik team
answered on 03 Jun 2011, 05:43 PM
Hello Joe,

In the RadTabControl when you activate a view, it doesn't get selected. This issue is logged in our PITS where you can track its progress. In the meantime you can examine this forum thread where possible workarounds for this issue are discusses. Also there is a feature request to implement a custom RadTabControl RegionAdapter to manage the RadTabControl behavior as a region in PRISM scenarios and you can vote for it here thus increasing its priority.

Also, I attached a sample project illustrating how to use the RadTabControl with MEF and create a custom RegionAdapter for the RadTabControl.

I am sorry to hear about your frustration with using the RadDocking control in a PRISM scenario. But hopefully the attached project will help you implement your scenario.

All the best,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Betsy
Top achievements
Rank 1
answered on 22 Jul 2011, 12:23 PM
Appears that this has been fixed in the lastest version of the controls (2011 Q2).  Thank you.
0
Daniel
Top achievements
Rank 1
answered on 09 Oct 2012, 10:56 PM
Hi,
Could you also tell me how to load two instances of the same module in two different tab items.

Thanks
0
Hristo
Telerik team
answered on 12 Oct 2012, 06:37 AM
Hi,

I've updated the sample project and attached it.
Please give it a look and let us know if you need more info.

Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Daniel
Top achievements
Rank 1
answered on 12 Nov 2012, 08:26 PM
This worked fine for silverlight with previous version of rad controls. Now i have version 2012.2.1001.1050 and the header doesn't show.
Can you please update me on this.

Thanks
0
Tina Stancheva
Telerik team
answered on 15 Nov 2012, 02:44 PM
Hi Daniel,

The issue is fixed in the latest official release Q3 2012 (v. 2012.3.1017). I attached the Silverlight version of the solution utilizing this release so that you can test it on your side as well. Let me know if it works.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Daniel
Top achievements
Rank 1
answered on 22 Jan 2013, 04:21 PM
It works.Thanks.
Tags
TabControl
Asked by
Betsy
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Betsy
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Tina Stancheva
Telerik team
Daniel
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or