Пример #1
0
        private static void OnSelectedIndexPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            AbleTabControl control  = source as AbleTabControl;
            int            newIndex = (int)e.NewValue;
            int            oldIndex = (int)e.OldValue;

            if (newIndex > control.ItemsSourceProperty.Count - 1 || newIndex < 0 ||
                oldIndex > control.ItemsSourceProperty.Count - 1 || oldIndex < 0)
            {
                return;
            }

            aVMTabBase newTab = control.ItemsSourceProperty[newIndex];
            aVMTabBase oldTab = control.ItemsSourceProperty[oldIndex];

            oldTab.IsSelected = false;
            oldTab.PublicNotifyPropChanged("IsSelected");

            newTab.IsSelected = true;
            newTab.PublicNotifyPropChanged("IsSelected");
            //control.SelectedIndex = newIndex;

            control.Dispatcher.BeginInvoke((Action)(() => control.RootTabControl.SelectedIndex = newIndex));
            //control.NotifyPropChanged("SelectedIndex");
            //control.RootTabControl.ContentTemplateSelector.SelectTemplate(oldTab, control.RootTabControl as DependencyObject);

            TabbedExpander TopTabExp            = control.RootTabControl.FindVisualChild <TabbedExpander>(x => (x as FrameworkElement).Name == "TopTabbedExpander");
            TabbedExpander BottomTabExp         = control.RootTabControl.FindVisualChild <TabbedExpander>(x => (x as FrameworkElement).Name == "BottomTabbedExpander");
            Grid           BTEGrid              = control.RootTabControl.FindVisualChild <Grid>(x => (x as Grid).Name == "TabControlGrid");
            RowDefinition  rowDef               = BTEGrid.RowDefinitions[3];
            TabbedExpanderBindingChanger filler = new TabbedExpanderBindingChanger(newTab as aTabsWithTabExpVM, ref TopTabExp, ref BottomTabExp, ref rowDef);

            control.RootTabControl.FindVisualChild <CargandoUC>(x => (x as FrameworkElement).Name == "CargandoUC")
            .SetBinding(UserControl.VisibilityProperty, control.NewCargandoMultiBinding(newTab));
        }
Пример #2
0
        private static void OnItemsPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            AbleTabControl control = source as AbleTabControl;

            var old = e.OldValue as ObservableCollection <VMTabDiario>;

            if (old != null)
            {
                // Unsubscribe from CollectionChanged on the old collection
                old.CollectionChanged -= control.ItemsSource_CollectionChanged;
            }

            var n = e.NewValue as ObservableCollection <VMTabDiario>;

            if (n != null)
            {
                // Subscribe to CollectionChanged on the new collection
                n.CollectionChanged += control.ItemsSource_CollectionChanged;
            }
        }
Пример #3
0
        /// <summary>
        /// Add new tab of type to abletabcontrol.
        /// </summary>
        /// <param name="type">See enum</param>
        public void AddTab(EjercicioDLOParaSideTool DLO)
        {
            aVMTabBase tab;

            AbleTabControl.AbleTabControl ATC = (App.Current.MainWindow as MainWindow).AbleTabControl;
            TabbedExpander TopTabExp          = ATC.FindVisualChild <TabbedExpander>(x => (x as TabbedExpander).Name == "TopTabbedExpander");
            TabbedExpander BottomTabExp       = ATC.FindVisualChild <TabbedExpander>(x => (x as TabbedExpander).Name == "BottomTabbedExpander");

            ATC.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, (Action)(() =>
            {
                Grid BTEGrid = ATC.FindVisualChild <Grid>(x => (x as Grid).Name == "TabControlGrid");
                RowDefinition rowDef = BTEGrid.RowDefinitions[3];
                string standardHeader = BuildTabHeader(this.LastTabCodigoComunidad, DLO, this.LastTabType);//  $"{this.LastTabCodigoComunidad} - {this.LastTabEjerHeader} - {TabHeaders[this.LastTabType]}";

                switch (this.LastTabType)
                {
                case TabType.Mayor:
                    tab = new VMTabMayor();
                    tab.Header = standardHeader;
                    TabbedExpanderFiller_Mayor TabExpFillerM = new TabbedExpanderFiller_Mayor(
                        tab as VMTabMayor,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;

                case TabType.Diario:
                    tab = new VMTabDiario();
                    tab.Header = standardHeader;
                    TabbedExpanderFiller_Diario TabExpFillerD = new TabbedExpanderFiller_Diario(
                        tab as VMTabDiario,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;

                case TabType.Props:
                    tab = new VMTabProps();
                    tab.Header = standardHeader;
                    break;

                case TabType.Cdad:
                    tab = new VMTabCdad();
                    tab.Header = standardHeader;
                    break;

                default:
                    tab = new VMTabMayor();
                    tab.Header = standardHeader;
                    TabExpFillerM = new TabbedExpanderFiller_Mayor(
                        tab as VMTabMayor,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;
                }
                this.Tabs.Add(tab);
                NotifyPropChanged("Tabs");
            }));
        }
Пример #4
0
 public Command_NavigateSelectedTab(AbleTabControl TabC)
 {
     this._TabC = TabC;
 }