Esempio n. 1
0
        public IRegion AdaptView(DependencyObject regionHost)
        {
            if (regionHost == null) throw new ArgumentNullException("regionHost");
            if (!(regionHost is StatusBar))
                throw new InvalidOperationException(
                    "This adapter only supports regionHosts that are StatusBars");

            var tabControl = (StatusBar)regionHost;
            var region = new SingleActiveViewRegion();
            new SynchronizeItemsBehavior().Attach(region, tabControl);
            return region;
        }
Esempio n. 2
0
        /// <summary>
        ///     Creates and attaches new region to <paramref name="regionHost"/>
        /// </summary>
        /// <param name="regionHost">Control that will become a region host</param>
        /// <returns>Created and attached region</returns>
        /// <exception cref="ArgumentNullException">When <paramref name="regionHost"/> is null</exception>
        /// <exception cref="InvalidOperationException">
        ///     When <paramref name="regionHost"/> is of type that is not supported by this adapter
        /// </exception>
        public IRegion AdaptView(DependencyObject regionHost)
        {
            if (regionHost == null) throw new ArgumentNullException("regionHost");
            if (!(regionHost is TabControl))
                throw new InvalidOperationException(
                    "This adapter only supports regionHosts that are TabControls");

            var tabControl = (TabControl) regionHost;
            var region = new SingleActiveViewRegion();

            new SynchronizeItemsBehavior().Attach(region, tabControl);
            new SynchronizeActiveItemsBehavior().Attach(region, tabControl);
            new ActiveAwareBehavior().Attach(region, tabControl);
            new TabControlHeaderTemplateSelectorBehavior().Attach(region, tabControl);
            return region;
        }
Esempio n. 3
0
        public IRegion AdaptView(DependencyObject regionHost)
        {
            if (regionHost == null)
            {
                throw new ArgumentNullException("regionHost");
            }
            if (!(regionHost is StatusBar))
            {
                throw new InvalidOperationException(
                          "This adapter only supports regionHosts that are StatusBars");
            }

            var tabControl = (StatusBar)regionHost;
            var region     = new SingleActiveViewRegion();

            new SynchronizeItemsBehavior().Attach(region, tabControl);
            return(region);
        }
Esempio n. 4
0
        /// <summary>
        ///     Creates and attaches new region to <paramref name="regionHost"/>
        /// </summary>
        /// <param name="regionHost">Control that will become a region host</param>
        /// <returns>Created and attached region</returns>
        /// <exception cref="ArgumentNullException">When <paramref name="regionHost"/> is null</exception>
        /// <exception cref="InvalidOperationException">
        ///     When <paramref name="regionHost"/> is of type that is not supported by this adapter
        /// </exception>
        public IRegion AdaptView(DependencyObject regionHost)
        {
            if (regionHost == null)
            {
                throw new ArgumentNullException("regionHost");
            }
            if (!(regionHost is TabControl))
            {
                throw new InvalidOperationException(
                          "This adapter only supports regionHosts that are TabControls");
            }

            var tabControl = (TabControl)regionHost;
            var region     = new SingleActiveViewRegion();

            new SynchronizeItemsBehavior().Attach(region, tabControl);
            new SynchronizeActiveItemsBehavior().Attach(region, tabControl);
            new ActiveAwareBehavior().Attach(region, tabControl);
            new TabControlHeaderTemplateSelectorBehavior().Attach(region, tabControl);
            return(region);
        }
 public void set_up()
 {
     _region = new SingleActiveViewRegion();
 }