Esempio n. 1
0
 protected override void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate)
 {
     templateApplied = false;
     if (oldTemplate != null)
     {
         m_ColorSlider.ValueChanged -= new RoutedPropertyChangedEventHandler<double>(BaseColorChanged);
         m_ColorDetail.MouseLeftButtonDown -= new MouseButtonEventHandler(OnMouseLeftButtonDown);
         m_ColorDetail.PreviewMouseMove -= new MouseEventHandler(OnMouseMove);
         m_ColorDetail.SizeChanged -= new SizeChangedEventHandler(ColorDetailSizeChanged);
         m_ColorDetail = null;
         m_ColorMarker = null;
         m_ColorSlider = null;
     }
     base.OnTemplateChanged(oldTemplate, newTemplate);
 }
Esempio n. 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            m_ColorDetail = GetTemplateChild(ColorDetailName) as FrameworkElement;
            m_ColorMarker = GetTemplateChild(ColorMarkerName) as Path;
            m_ColorSlider = GetTemplateChild(ColorSliderName) as SpectrumSlider;
            m_ColorSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(BaseColorChanged);

            m_ColorMarker.RenderTransform = markerTransform;
            m_ColorMarker.RenderTransformOrigin = new Point(0.5, 0.5);
            m_ColorDetail.MouseLeftButtonDown += new MouseButtonEventHandler(OnMouseLeftButtonDown);
            m_ColorDetail.PreviewMouseMove += new MouseEventHandler(OnMouseMove);
            m_ColorDetail.SizeChanged += new SizeChangedEventHandler(ColorDetailSizeChanged);

            templateApplied = true;
            shouldFindPoint = true;
            isAlphaChange = false;

            SelectedColor = m_color;
        }