Ejemplo n.º 1
0
        private static void SliderListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MultiSlider ms = (MultiSlider)d;

            if (ms.UpSliders == null || ms.DownSliders == null)
            {
                return;
            }

            ms.ReArrangeSliderItems();
            //ms.ApplyTemplate();
            //ms.UpSliders = ms.Template.FindName("PART_UpSliders", ms) as Grid;
            //ms.UpSliders.Children.Add(ms.SliderList[0]);
        }
Ejemplo n.º 2
0
        private static void OnUpdatePatternCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MultiSlider ms = (MultiSlider)d;

            ms.ReArrangeSliderItems();
        }
Ejemplo n.º 3
0
        private static void OnSelectedScreenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            List <SliderItem> activeSliderList   = null;
            MultiSlider       activeMultiSlider  = null;
            MultiSlider       passiveMultiSlider = null;

            if (d != null)
            {
                EffectUC uc = (EffectUC)d;
                uc.SelectedSlider = null;

                if (uc.SelectedScreen == 0)
                {
                    activeSliderList              = uc.UpSliderList;
                    activeMultiSlider             = uc.upMultiSlider;
                    passiveMultiSlider            = uc.downMultiSlider;
                    uc.upMultiSlider.Visibility   = Visibility.Visible;
                    uc.downMultiSlider.Visibility = Visibility.Hidden;
                }
                else
                {
                    activeSliderList              = uc.DownSliderList;
                    activeMultiSlider             = uc.downMultiSlider;
                    passiveMultiSlider            = uc.upMultiSlider;
                    uc.upMultiSlider.Visibility   = Visibility.Hidden;
                    uc.downMultiSlider.Visibility = Visibility.Visible;
                }

                BindingOperations.ClearBinding(passiveMultiSlider, MultiSlider.SelectedSliderProperty);
                BindingOperations.SetBinding(activeMultiSlider, MultiSlider.SelectedSliderProperty, new Binding("SelectedSlider")
                {
                    Source = uc, Mode = BindingMode.TwoWay
                });

                foreach (SliderItem si in activeSliderList)
                {
                    if (si.IsSelected)
                    {
                        uc.SelectedSlider = si;
                    }
                }

                uc.SetActiveList.Execute(activeSliderList);
                uc.colorPanel.SetPanel(activeSliderList[0].SliderType);

                //if (uc.SelectedScreen == 0)
                //{
                //    BindingOperations.ClearBinding(uc.downMultiSlider, MultiSlider.SelectedSliderProperty);

                //    uc.downMultiSlider.Visibility = Visibility.Hidden;
                //    uc.upMultiSlider.Visibility = Visibility.Visible;
                //    BindingOperations.SetBinding(uc.upMultiSlider, MultiSlider.SelectedSliderProperty, new Binding("SelectedSlider") { Source = uc, Mode = BindingMode.TwoWay });

                //    foreach (SliderItem si in uc.UpSliderList)
                //        if (si.IsSelected)
                //            uc.SelectedSlider = si;

                //    uc.SetActiveList.Execute(uc.UpSliderList);
                //    uc.colorPanel.SetPanel(uc.UpSliderList[0].SliderType);
                //}
                //else
                //{
                //    BindingOperations.ClearBinding(uc.upMultiSlider, MultiSlider.SelectedSliderProperty);
                //    uc.SelectedSlider = null;
                //    uc.upMultiSlider.Visibility = Visibility.Hidden;
                //    uc.downMultiSlider.Visibility = Visibility.Visible;
                //    BindingOperations.SetBinding(uc.downMultiSlider, MultiSlider.SelectedSliderProperty, new Binding("SelectedSlider") { Source = uc, Mode = BindingMode.TwoWay });

                //    foreach (SliderItem si in uc.DownSliderList)
                //        if (si.IsSelected)
                //            uc.SelectedSlider = si;
                //    uc.SetActiveList.Execute(uc.DownSliderList);
                //    uc.colorPanel.SetPanel(uc.DownSliderList[0].SliderType);
                //}
            }
        }