Provides a way for a site's navigation settings to determine the SiteMapProvider instance that should be used when rendering a page.
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
The SwitchableSiteMapProvider provides a way for a single master page to support several different possible navigation configurations. When you are designing a master page for a specific web site, you may know which navigation provider will be used, and you can avoid a lot of complexity by specifying it directly in your master page. For example, your AspMenu control can bind to a data source such as the PortalSiteMapDataSource control, which specifies a name such as "GlobalNavigation" that references a SiteMapProvider instance from the web.config file. This chain is represented in the master page markup and only involves two ASP.NET controls.
By contrast, the standard system master page relies on two different switching criteria to support three different navigation models. If the publishing navigation feature is active, the master page contains a DelegateControl object that by default points to the navigation provider that is used for basic sites. If the feature is enabled, this DelegateControl object replaces its data source with the PortalSiteMapDataSource control that is defined by the feature XML in the TEMPLATE\FEATURES\Navigation\NigationSiteSettings.xml file.
In previous versions of SharePoint Server, this new data source was bound to the GlobalNavigationProvider, which is an instance of the PortalSiteMapProvider object. In , a second switching criteria was introduced: each site can choose between a TaxonomySiteMapProvider and a PortalSiteMapProvider. This is accomplished by binding the data source to the SwitchableSiteMapProvider object, which acts as a wrapper that reads the active settings, and then passes the calls through to the appropriate provider.
Since the provider types have very different behaviors and usage scenarios, they require different settings for properties such as SiteMapDataSource.StartFromCurrentNode and SiteMapDataSource.ShowStartingNode. The SwitchableProperty XML tag provides a way for the PortalSiteMapDataSource control to embed these alternate property values within the PortalSiteMapDataSource markup, by means of the ASP.NETParseChildrenAttribute mechanism. A slightly different syntax is used to accomplish this in the limited feature XML language used by the DelegateControl object, but the concept is the same.
The active provider can be determined by calling the GetCurrentWrappedProvider() method.