public IRegion AdaptView(DependencyObject regionHost) { if (regionHost == null) { throw new ArgumentNullException("regionHost"); } if (!(regionHost is ToolBarTray)) { throw new InvalidOperationException( "This adapter only supports regionHosts that are Toolbars"); } var tabControl = (ToolBarTray)regionHost; var region = new MultipleActiveViewRegion(); new SynchronizeToolbarsBehavior().Attach(region, tabControl); return(region); }
public IRegion AdaptView(DependencyObject regionHost) { if (regionHost == null) { throw new ArgumentNullException("regionHost"); } if (!(regionHost is ItemsControl)) { throw new InvalidOperationException( "This adapter only supports regionHosts that are ItemsControls"); } var itemsControl = (ItemsControl)regionHost; var region = new MultipleActiveViewRegion(); new SynchronizeItemsBehavior().Attach(region, itemsControl); new ActiveAwareBehavior().Attach(region, itemsControl); return(region); }