Hiding the tab controls

Topics: Prism v2 - Silverlight 3
Aug 7, 2009 at 11:43 PM


Using Prism in Silverlight, is there any way to completely hide the tab UI of a TabControl? I want the functionality of switching tabs but I want to use my own UI that is not attached in the same way. Any ideas?

I have tried using an ItemsControl but am having issues showing and hiding the views.

Thank you,


Aug 8, 2009 at 4:55 AM

Sounds to me like you really just want to use the ContentsControl instead of the ItemsControl so you only have 1 active view. I am using this as a Window Manager and then when they click on the window item, the main panel (ContentsControl) has its active view switched to the one click.

Aug 8, 2009 at 6:13 PM

Essentially I want one window that has three overlapping views. The user can switch between them by clicking a widget. I don't think a ContentControl will work well for that.



Aug 8, 2009 at 8:05 PM

Are you saying that you want parts of all 3 controls to be visible at the same time or like the tab control where there is only one "active" view? If it is the one active view then the ContentControl IS the right choice for you. You would use the IRegion to Activate and Deactivate the view that you currently want shown. Then you are free to create any special widget to control the activating of those views.

Aug 9, 2009 at 3:25 PM
Edited Aug 9, 2009 at 3:26 PM

Hi rboarman,

As an example of what fredhirschfeld is suggesting I offer the following code:

    void buttonClickHandler(object sender, System.Windows.RoutedEventArgs e)
      // Cast sender to button so we can access it easier
      Button button = sender as Button;

      Logger.Log(string.Format("Button Click: {0} for View: {1}",
        button.Name,button.Tag), Category.Debug, Priority.None);

      aggregator.GetEvent<StatusEvent>().Publish(new StatusEventArgs
        Message = string.Format("View {0} selected", button.Tag),
        StatusPanel = StatusType.Left  // Left status bar

      // Disable the button just clicked
      button.IsEnabled = false;

      // Get all views that are using MainRegion
      IRegion mainRegion = regionManager.Regions["MainRegion"];
      // Activate the view if the view name matches the current
      // button's tag value.  
      foreach (IViewBase view in mainRegion.Views)
        if (view.Name.Contains(button.Tag.ToString()))

I use this code to swap out (activate) the layout that will be utilized in my "MainRegion".  I load multiple 
views into my main region and above my MainRegion have a MenuRegion.   The menu region contains
buttons that contain the name of the View in it's tag (extensible).   The above code resides in my MenuPresenter.
Aug 10, 2009 at 7:22 AM

I also used a ContentControl for this at the beginning, before switching to a TrasitioningContentControl, which lets you define an animation that is displayed when pages are switched.

Aug 12, 2009 at 10:54 PM

This was solved using Activate. Thank you all.