TabControl +Active View

Sep 13, 2008 at 10:29 AM
Hi list,
i have to following xaml in Window1:

<

 

TabControl Name ="TabItem" Margin="5"

 

 

ItemContainerStyle="{StaticResource HeaderStyle}"

 

 

cal:RegionManager.RegionName="MainRegion">

 

 

 

<transc:TransitionElement x:Name="TransitionBox">

 

 

 

<transc:TransitionElement.TransitionSelector>

 

 

 

<trans:RandomTransitionSelector>

 

 

 

<transt:DoorTransition/>

 

 

 

<transt:DotsTransition/>

 

 

 

<transt:RotateTransition Angle="45" />

 

 

 

<transt:RollTransition/>

 

 

 

</trans:RandomTransitionSelector>

 

 

 

</transc:TransitionElement.TransitionSelector>

 

 

 

</transc:TransitionElement>

 

 

 

</TabControl>
when adding tabItems to the tabControl like :

 

public

 

void ShowListView()

 

{

transitionElement.Content =

this.listPresenter.View;

 

 

IRegion region = regionManager.Regions["MainRegion"];

 

region.Add(transitionElement,

"EmplList");

 

region.Activate(transitionElement);

 

}

 

the selected item in the tabControl dosn't change.
Any idea how to make the newly added view the active view??

Thanks
Peter

 

 

Sep 15, 2008 at 6:56 AM
Hi Peter,

After adding a view to the tabcontrol region you need to activate it.
This can be done by invoking region.Activate(transitionElement).

Hope this helps.

WillemM
Sep 15, 2008 at 8:19 AM
Hi,
and thanks for your answer.

I did this already as you can see in my posted codesnippet.
....

region.Add(transitionElement,

 

"EmplList");

 

region.Activate(transitionElement);

 

}
........

Any other idea????
Thanks  in advance
Peter

Sep 22, 2008 at 9:30 AM
Hi Peter,
you are assigning a named view to the region "MainRegion".
Try to remove the name "EmplList" or change it for each tabbed-view you are adding.

-Riccardo