예제 #1
0
        /// <summary>
        /// Handles when the Text property is changed
        /// </summary>
        /// <param name="dependency"></param>
        /// <param name="e"></param>
        protected static void UpdateText(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
        {
            ColorLabel colorLabel = (ColorLabel)dependency;

            colorLabel.textBlock.Text = (string)e.NewValue;
            colorLabel.textBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            colorLabel.colorSize.Width = colorLabel.textBlock.DesiredSize.Height * 1.5;
        }
예제 #2
0
        // ********************************************************************
        // Event Handlers
        // ********************************************************************
        #region Event Handlers

        /// <summary>
        /// Handles when the Color property is changed
        /// </summary>
        /// <param name="dependency"></param>
        /// <param name="e"></param>
        protected static void UpdateColor(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
        {
            ColorLabel colorLabel = (ColorLabel)dependency;
            Color      newColor   = (Color)e.NewValue;

            colorLabel.color.Color = newColor;

            /*
             * if (newColor == Colors.Transparent)
             *      colorLabel.colorSize.Visibility = Visibility.Collapsed;
             * else
             *      colorLabel.colorSize.Visibility = Visibility.Visible;
             */
        }