Esempio n. 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));
        }
Esempio n. 2
0
 public TabbedExpanderBindingChanger(
     aTabsWithTabExpVM TabExpVMContainer,
     ref TabbedExpander topTE,
     ref TabbedExpander bottomTE,
     ref RowDefinition rowDef)
     : base(TabExpVMContainer, 3, ref topTE, ref bottomTE, ref rowDef, false)
 {
 }
Esempio n. 3
0
 public TabbedExpanderFiller_Mayor(
     VMTabMayor TabExpVMContainer,
     ref TabbedExpander topTE,
     ref TabbedExpander bottomTE,
     ref RowDefinition rowDef,
     bool fill)
     : base(TabExpVMContainer, 3, ref topTE, ref bottomTE, ref rowDef, fill)
 {
 }
Esempio n. 4
0
 public TabbedExpanderFiller_Cdad(
     VMTabCdad TabExpVMContainer,
     ref TabbedExpander topTE,
     ref TabbedExpander bottomTE,
     ref System.Windows.Controls.RowDefinition rowDef,
     bool fill)
     : base(TabExpVMContainer, 3 /*<------------OJO*/, ref topTE, ref bottomTE, ref rowDef, fill)
 {
 }
Esempio n. 5
0
        public AbleTabControl()
        {
            InitializeComponent();

            ItemsSourceProperty       = new ObservableCollection <aVMTabBase>();
            this._NavigateSelectedTab = new Command_NavigateSelectedTab(this);

            //Task.Run(() => SetInitializeTaskBindingAsync());
            this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, (Action)(() =>
            {
                SetInitializeTaskBinding();
                Grid BTEGrid = this.RootTabControl.FindVisualChild <Grid>(x => (x as Grid).Name == "TabControlGrid");
                RowDefinition rowDef = BTEGrid.RowDefinitions[3];
                TabbedExpander BTE = this.RootTabControl.FindVisualChild <TabbedExpander>(x => (x as FrameworkElement).Name == "BottomTabbedExpander");
                rowDef.Height = new GridLength(BTE.EXPANDER_NOTEXPANDED_HEIGHT);
            }));
        }
Esempio n. 6
0
        public aTabbedExpanderFillerBase(
            T container,
            int numberOfTabs,
            ref TabbedExpander topTE,
            ref TabbedExpander bottomTE,
            ref RowDefinition rowDef,
            bool fill)
        {
            this._TabExpContainer = container;
            this._NumberOfTabs    = numberOfTabs;

            if (fill)
            {
                FillTopTabExp();
                FillBottomTabExp();
            }
            BindTabbedExpanders(ref topTE, ref bottomTE, ref container, ref rowDef);
        }
Esempio n. 7
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");
            }));
        }
Esempio n. 8
0
        protected void BindTabbedExpanders(ref TabbedExpander TopTE, ref TabbedExpander BottomTE, ref T tab, ref RowDefinition rowDef)
        {
            TopTE.SetBinding(
                TabbedExpander.ItemsSourceProperty,
                new Binding()
            {
                Source = tab,
                //Path = new PropertyPath((tab as aTabsWithTabExpVM).TopTabbedExpanderItemsSource),
                Path = new PropertyPath("TopTabbedExpanderItemsSource"),
                Mode = BindingMode.OneWay
            });
            TopTE.SetBinding(
                TabbedExpander.SelectedIndexProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("TopTabbedExpanderSelectedIndex"),
                Mode   = BindingMode.TwoWay
            });

            BottomTE.SetBinding(
                TabbedExpander.ItemsSourceProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("BottomTabbedExpanderItemsSource"),
                Mode   = BindingMode.TwoWay
            });
            BottomTE.SetBinding(
                TabbedExpander.SelectedIndexProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("BottomTabbedExpanderSelectedIndex"),
                Mode   = BindingMode.TwoWay
            });
            BottomTE.SetBinding(
                TabbedExpander.IsExpandedProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("BTEExpanded"),
                Mode   = BindingMode.OneWayToSource
            });
            BottomTE.SetBinding(
                TabbedExpander.EXPANDER_EXPANDED_HEIGHTProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("ExpandedHeight"),
                Mode   = BindingMode.OneWay
            });

            double height = BottomTE.EXPANDER_NOTEXPANDED_HEIGHT;

            BottomTE.SetBinding(
                TabbedExpander.EXPANDER_NOTEXPANDED_HEIGHTProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("NotExpandedHeight"),
                Mode   = BindingMode.OneWayToSource
            });
            BottomTE.EXPANDER_NOTEXPANDED_HEIGHT = height;

            rowDef.SetBinding(
                RowDefinition.HeightProperty,
                new Binding()
            {
                Source = tab,
                Path   = new PropertyPath("BTEGridHeight"),
                Mode   = BindingMode.TwoWay
            });

            /*MultiBinding MBind = new MultiBinding();
             * MBind.Bindings.Add(new Binding() { Source = BottomTE, Path = new PropertyPath("IsExpanded"), Mode = BindingMode.OneWay });
             * MBind.Bindings.Add(new Binding() { Source = tab, Path = new PropertyPath("BTEGridHeight"), Mode = BindingMode.TwoWay });
             * MBind.Bindings.Add(new Binding() { Source = BottomTE, Path = new PropertyPath("EXPANDER_NOTEXPANDED_HEIGHT"), Mode = BindingMode.OneWay });
             * MBind.Converter = new BoolHeightToHeightMulticonverter();
             * MBind.ConverterParameter = "GRID";
             * MBind.Mode = BindingMode.TwoWay;
             * MBind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
             * rowDef.SetBinding(RowDefinition.HeightProperty, MBind);*/
        }